D.C.'s former mayor Vincent Gray beat incumbent Yvette M. Alexander by a wide margin in the primary for the Ward 7 council seat on June 14. "I feel so excited that the people of Ward 7 have given me the opportunity to once again represent them," Gray said. (WUSA9)

D.C.'s former mayor Vincent Gray beat incumbent Yvette M. Alexander by a wide margin in the primary for the Ward 7 council seat on June 14. "I feel so excited that the people of Ward 7 have given me the opportunity to once again represent them," Gray said. (WUSA9)

District voters ousted three D.C. Council members — including 12-year veteran Vincent B. Orange — and welcomed back former mayor Vincent C. Gray in Democratic primaries marked by concerns about violent crime and gentrification in the nation’s capital.

Gray trounced Yvette M. Alexander, his onetime protege, in the primary for the Ward 7 council seat. It was a redemptive return for Gray, who lost his mayoral reelection bid two years ago amid a federal investigation into his campaign finances that resulted in guilty pleas for six of his associates but no charges against Gray.

In the only citywide contest, Orange lost the primary for his at-large seat to Robert White, a former aide to Del. Eleanor Holmes Norton and a newcomer to public office.

“All I can say is that I’m proud of my record and believe I have left the city in a better place, especially working families,” Orange said. “Now it is time for the city to pull together under new leadership.”

White said that while many might be surprised by his upset win, he knew that voters wanted change. “There is a mandate, absolutely,” he said.

Ward 7 incumbent Yvette Alexander reacts after casting her ballot in the gymnasium at Highlands Elementary School. (Christian K. Lee/The Washington Post)

The other casualty Tuesday was LaRuby May, who conceded to Trayon White, losing the primary for the Ward 8 council seat that was occupied by Marion Barry until his death in 2014.

The upheaval on the council dealt a major blow to D.C. Mayor Muriel E. Bowser (D), who had considered Alexander, Orange and May allies to help her push through her legislative agenda. In the heavily Democratic city, winning the party primary almost assures election in November. Twenty four percent of eligible voters cast ballots Tuesday.

Bowser was especially opposed to Gray’s return to politics, tapping her own fundraising network and donating top aides to help Alexander. She now can expect to face a council that includes two adversarial lawmakers from the eastern half of the city — predominantly African American wards she would probably need to win reelection in two years.

Terry Lynch, a neighborhood activist, said the election was a clear referendum on the city’s rising homicide rate and the botched investigation of Gray.

“When homicide rates are up over 50 percent, what family, what block, has not been touched by the deadly violence?” Lynch said. “And on the former mayor, not being indicted, he was dealt a raw deal, and people feel that.”

Many voters east of the Anacostia River also said they worry about the impact of gentrification and want officials to do more to help struggling residents stay in the District.

The only Bowser ally to survive was her handpicked successor from her home ward, Brandon T. Todd (Ward 4), who fended off three primary challengers.

Ward 8 council candidate Trayon White talks with voters at Turner Elementary School. (Linda Davidson/The Washington Post)

May, a former top campaign organizer for Bowser, said she accepted voters’ decision. “I trust God,” she said. “What this means is He has a different path.”

At his victory party at Georgena’s Player Lounge in Anacostia, White was jubilant. “We sent a message throughout the metropolitan area that we’re here to stay. . . . We’re in the people business,” he said, as Kurtis Blow, one of the country’s first rap artists, was on hand to congratulate him.

Gray arrived at his election night celebration at a Deanwood church to a standing ovation. He raised a fist in the air as he stood onstage to address volunteers and promised that construction cranes would soon go up and violent crime would come down in Ward 7.

“I’m not going to take a lot of time to celebrate,” Gray told the gathering, his voice breaking. “I’m ready to move on to the next steps.”

Council members Mary M. Cheh (D-Ward 3) and David Grosso (I-At Large) and Chairman Phil Mendelson (D) came to congratulate Gray.

Earlier in the evening, Gray, 73, said he might run again for mayor.

“It would be foolish for me to rule anything out,” he said as he thanked voters leaving the polls at River Terrace Elementary School shortly before 6 p.m. “I don’t know; we’ll see what happens.”

Deborah Best, a 63-year-old cashier and foster grandmother, voted for Gray and second chances. “They had nothing,” said Best, referring to federal prosecutors, who ended their investigation in December. “I’ll give him another chance.”

Some voters reported problems in casting ballots Tuesday, complaining that their party affiliation had been switched without their knowledge. The D.C. Board of Elections said a technical error was probably at fault and appeared to be rooted in its new Web app. Officials said they did not know how many voters were affected but said it was no more than 400.

In addition to the local races, the primaries included the Democratic contest for president, the last in the party’s long nomination process. But it seemed a futile exercise to many D.C. voters, coming more than a week after Hillary Clinton secured enough support to lock up the nomination over Sen. Bernie Sanders (Vt.). Clinton easily beat Sanders on Tuesday.

Gray and Bowser have had a frosty relationship since 2010, when Gray, then council chairman, knocked out Bow­ser’s mentor, incumbent Adrian M. Fenty, in the mayoral primary. Tensions intensified two years later when federal prosecutors announced their investigation into the 2010 campaign and Bowser quickly called on Gray to resign as mayor.

The investigation of illegal campaign financing resulted in guilty pleas by six of Gray’s former campaign aides. Still, he lost the 2014 primary battle to Bowser.

In his council campaign, launched in February, Gray quickly focused on issues that affect residents east of the Anacostia River, saying he was running to improve economic development and job-training programs.

He also seized on a soaring homicide rate in Ward 7, questioning the leadership of Alexander and Bowser and noting that crime had dropped to historic lows when he was mayor.

Gray would bring a conservative approach to fiscal and policing issues and could help Bowser in her push for D.C. statehood, also one of Gray’s top priorities.

Gerald Glover, a longtime Gray supporter, said he would feel more comfortable with Gray back in office. Amid a generational turnover on the council, Glover said, he sees the former mayor as part of a fading breed of D.C. politicians, including former council chairmen John A. Wilson and David Clarke.

“I want leaders to know their roots,” said Glover, a community advocate and funeral home worker.

But Brian Boger, who campaigned for Gray in 2010, said roots aren’t enough, and he voted for Alexander. “She’s clean,” he said. “Any vote for Gray is a vote for corruption and scandal.”

In a brief interview after his victory remarks, Gray said voters sent a clear signal that they are dissatisfied with the status quo.

“This electorate said, ‘You know what, we don’t like where things are going, and we want change,’ ” he said.

He said his win is another sign that he’s moved on from the federal probe into his 2010 campaign finances.

“It’s behind me,” he said. “It’s history. Let’s make it history. And I don’t want to hear that question again.”

Ian Shapira, Elise Schmelzer, Rachel Weiner, Julie Zauzmer and Perry Stein contributed to this report.