WASHINGTON — Muriel Bowser won the District of Columbia’s Democratic mayoral primary Tuesday, defeating incumbent Vincent Gray in a race defined by a scandal involving Gray’s campaign four years ago.
Bowser tapped into an electorate that tired of the allegations surrounding Gray, whose associates have been convicted of involvement in an illegal slush fund that aided his 2010 campaign.
Bowser is a D.C. councilmember and a protege of former mayor Adrian Fenty, whom Gray defeated in 2010.
She will face independent D.C. Councilmember David Catania in what could be an unusually competitive general election in November. The primary winner has gone on to win every general election since the district began electing a mayor 40 years ago.
Gray won the election in 2010 by tapping into dissatisfaction among African-American residents.
But a series of guilty pleas in federal court have revealed that top aides to the mayor broke the law to help him get elected.
Three weeks ago, prosecutors said Gray knew about an illegal $668,000 slush fund that aided his get-out-the-vote efforts.
Gray has not been charged and insists he did nothing wrong. His attorney has said he is preparing for a possible indictment.
‘‘It’s too much. We’ve gone through scandals before in D.C., and we don’t need any more,’’ said Rufus Okunubi, 68, a cab driver who backed Gray in 2010, but voted for Bowser this time.
Problems with electronic voting machines had led to a delay in reporting results.