City councilor Muriel Bowser bested D.C. Mayor Vincent Gray in the Democratic primary, ending his bid for a second term. Gray's administration has been tarnished by prosecutions of campaign-finance misconduct.

District of Columbia voters signaled their discomfort Tuesday with yet another scandal-tainted mayor, ousting incumbent Vincent Gray in the Democratic primary and throwing their support behind city councilwoman Muriel Bowser, who is now in prime position to win in November.

Mayor Gray, who has not been charged with any illegal conduct, nonetheless saw voter support for his reelection erode sharply after a businessman pleaded guilty March 10 to illegally contributing more than $660,000 to Gray's mayoral campaign in 2010. Federal prosecutors said at a court hearing that Gray had been aware of the scheme.

Since then, several former officials in Gray’s administration have pleaded guilty to breaking federal campaign finance laws, according to The Associated Press. Gray said he had no knowledge of wrongdoing, but the race in its waning weeks became a referendum on ethics in government.

Ms. Bowser, who has served on the D.C. city council since 2007, was able to capitalize on the campaign-finance improprieties swirling around Gray, and in the end won the contest handily. Trailing with 33 percent of the vote to Bowser's 44 percent (with 71 percent of the votes counted), Gray conceded the race early Wednesday morning.

The district's voters are no strangers to mayoral misconduct. Former Mayor Marion Barry Jr. was arrested in 1990 for smoking crack cocaine and served six months in federal prison. Even so, he was reelected as D.C. mayor for one term in 1994 and today serves on the city council.

But D.C. voters appeared less tolerant of Gray administration improprieties related to campaign donations. Whereas Gray comfortably led in the polls of Democratic voters three weeks ago, by March 23 Bowser had overtaken the mayor and held a 3-point lead, a Washington Post poll showed. (The Post endorsed Bowser.) In that poll, almost half of respondents said that prosecutors' allegations that Gray knew of the illegal campaign finance scheme would be for them a “major factor” on Election Day, and another one-quarter called them a “minor factor.” A majority of respondents said they believed Gray had done something either “illegal” or “unethical,” and more than 60 percent said they believed the mayor had been aware of the wrongdoing.

In his campaign, Gray sought to portray Bowser as unqualified to serve as mayor of America's capital city, saying her legislative experience is slight. On the city council, she represents Ward 4, a mostly affluent and slightly majority-black part of the district.

Bowser’s campaign, in turn, centered on housing and education reforms that she said would benefit low-income residents getting squeezed out of an increasingly prosperous and condo-centric city. But Bowser also seized on voters' rising doubts about Gray's integrity.

On March 11, one day after US prosecutors publicly accused Gray of knowing about campaign-finance irregularities, Bowser opened her response to the mayor's State of the District address with this pledge to residents: If elected, she would not break the law.

“Yesterday was a tragic one for D.C. politics and for our city,” she said. “Federal prosecutors detailed the worst kind of corruption: trading illegal, under-the-table campaign cash for government contracts and personal favors.

“I am relieved that this mess is almost behind us. And most of all, I am hopeful,” she said. “I am hopeful because the D.C. future is bright.”

In the November general election, no Republican is vying for mayor. Bowser will face independent candidate David Catania, also a city council member.