Gray maintained a double-digit lead as results trickled out from the city's Board of Elections, which was implementing a new voting system that delayed the returns. With 28 percent of precints reporting, Gray had 56 percent of the vote to 42 percent for Fenty.

Based on the incomplete results, The Washington Post projected Gray would win the primary.

The Associated Press called the race for Gray early Wednesday morning. With 90 percent of precincts reporting, Gray had 53 percent to Fenty's 46.

It was a surprising result, considering how popular Fenty's leadership was when he took office in 2007.

But he'd recently been criticized for being aloof and not connecting with voters, as well as for taking too hard a stance in reforming the city’s school system. Fenty was also criticized for running a poor campaign, with observers noting he competed in Washington’s triathlon Sunday morning, less than 48 hours before the polls opened.

Fenty was popular with many white Washington voters but was viewed unfavorably by many in the African-American community, polls showed. A Clarus Poll released last week had Gray leading Fenty 45 percent to 38 among likely Democratic primary voters, with 14 percent undecided.

The mayor hinted in an interview Monday that President Obama may have raised the bar with the city's African-American community.

"Maybe in the African-American community, despite the results, despite the effectiveness of the government, they're saying, and again I've heard this door to door, 'Do an even better job connecting, engaging, that's what we have grown to expect from not just mayors but other leaders,' " Fenty told Fox 5 D.C. "And I hear it. I hear them. I understand where I've fallen short."

Fenty and Obama appeared to be on friendly terms during the inauguration festivities in January 2009. But the president did not endorse in the race, and Gray was able to capitalize on a run-in with the president at a Washington Mystics game in August. He had a photo taken of the men shaking hands, which he tweeted to his supporters.

White House deputy press secretary Bill Burton was asked Tuesday why Obama hadn’t stepped into the mayoral race.

"The president doesn't get involved in every single race, and didn’t get involved in a lot of them today," Burton said.


Gray's supporters were euphoric early Wednesday morning. "We haven't had this kind of moment since Obama was elected," one supporter at the victory rally told Fox 5 D.C.

Gray was dogged by accusations his administration would look like that of former Mayor Marion Barry, who was had various run-ins with the law, including an arrest on crack cocaine charges. Washington had one of the highest murder rates in the country during his administration in the 1980s, earning the nickname the "murder capital."

“I don't have any idea why anybody would come to that conclusion," Gray, who didn't serve on the Council while Barry was mayor, told reporters on Monday.

The winner of the Democratic primary is expected to clinch the mayor's office in November.

— This post was updated at 2:27 a.m.