ST. LOUIS — A seven-term prosecuting attorney in St. Louis County who gained national attention with his handling of the investigation of the fatal police shooting of Michael Brown in Ferguson lost a primary challenge Tuesday to a black Ferguson councilman, according to unofficial results.

With the vote counted from all precincts, the county reported Wesley Bell with a 57 percent to 43 percent victory over 67-year-old Bob McCulloch in the Democratic primary. No Republicans were on the ballot, making Bell all but certain to win in November.

Michael Brown

Bell, 43, is an attorney and former municipal judge and prosecutor. He was elected councilman in 2015 as protests continued to rage over Brown’s death.

At a raucous election night party, Bell recalled that even close friends told him he had no chance. He called for unity.

“There’s too much divisiveness, too much division in this county, in this region,” Bell said in a video posted on his campaign Facebook page. “We’ve got to start bringing people together.”

McCulloch couldn’t be reached for comment.

The prosecutor’s race put Ferguson back into the spotlight four years after Brown’s death led to months of often violent protests, prompted significant reforms in the St. Louis suburb and helped fuel the national Black Lives Matter movement.

Many onlookers saw the election as a referendum on what happened in Ferguson. It marked the first time McCulloch had been challenged since Brown’s death.

Brown, a black and unarmed 18-year-old, died on Aug. 9, 2014, in a street confrontation with white Officer Darren Wilson. Some witnesses said Brown had his hands up in surrender. Wilson said Brown was moving aggressively toward him and he fired the fatal shots in self-defense.

Darren WilsonREUTERS

A St. Louis County grand jury declined to indict Wilson, who later resigned. Critics accused McCulloch, who is white, of skewing the investigation in favor of the officer.

The US Department of Justice launched its own investigation. While the Justice Department found no grounds to indict Wilson, a scathing report found racial bias in the way Ferguson police and courts treated black people. A consent agreement requires the city to take several steps to remove that bias, including hiring more minority police officers, court reforms, and other measures.

Bell campaigned on a platform to “fundamentally change the culture” of the prosecutor’s office, partially by assigning special prosecutors to review allegations of police misconduct. Black residents make up about 23 percent of St. Louis County’s population.

Bell and McCulloch are both sons of police officers. But McCulloch, an ardent police supporter, became a target of critics who unsuccessfully demanded he recuse himself from the Brown case, citing his family history. Several of his relatives worked for the St. Louis police department, including his father, who was fatally shot by a black suspect when McCulloch was 12.