A longtime prosecutor who led the investigation into the fatal police shooting of Michael Brown in Ferguson, Missouri, was defeated in a stunning primary election upset Tuesday.

Bob McCulloch, who served seven terms as a prosecuting attorney in St. Louis County, lost the Democratic primary to Wesley Bell, an attorney and former municipal judge and prosecutor. Bell was elected to the city council in 2015.

McCulloch, 67, is an ardent police supporter and became a target of critics who unsuccessfully demanded he recuse himself from the Brown case.

Brown, who was unarmed, was fatally shot in August 2014 during a confrontation with Officer Darren Wilson, who is white. Wilson said he shot the 18 year old in self-defense.

In a campaign video, McCulloch said he’s had success with prosecuting violent criminals, adding that the crime rate is the lowest it’s been since the early 1970s. He also touted the county’s treatment programs for those with mental illness and drug addictions.

FOX NEWS MIDTERM ELECTIONS

One of Bell’s campaign promises was to take a “risk-based” approach to setting bail, according to the St. Louis Post-Dispatch. He said he wanted to end the cash bail system for nonviolent defendants because “we are intentionally criminalizing poverty.”

He also wanted to “fundamentally change the culture” of the prosecutor’s office, partially by assigning special prosecutors to examine allegations of police misconduct.

“People keep saying, ‘you shocked the world,’” Bell said after his victory, according to KMOV-TV. “No, we shocked the world. People showed up and showed out.”

MCCASKILL, HAWLEY EASILY WIN MISSOURI PRIMARIES TO SET UP KEY SENATE SHOWDOWN

Jeffrey A. Mittman, executive director of the American Civil Liberties Union of Missouri, said Bell’s victory shows “voters care passionately about crucial civil rights issues from the unjust use of cash bail to how long people are sitting in our jails because they can’t afford to pay, to demanding their prosecuting attorney be transparent on his office’s work.”

Bell is running unopposed in the November election as no other party put forth candidates. He defeated McCulloch with 57 percent of the vote.

The Associated Press contributed to this report.