D.C. voters upended city hall politics in Tuesday’s Democratic primary, ousting an ally of Mayor Muriel E. Bowser in favor of an insurgent left-leaning candidate and ending the political career of a veteran lawmaker tarred by scandal.

D.C. Council member Brandon T. Todd (D-Ward 4) lost his reelection bid to Janeese Lewis George, a lawyer and self-identified democratic socialist who had been endorsed by her former employer, D.C. Attorney General Karl A. Racine (D).

In affluent Ward 2, voters decisively rejected Jack Evans’s attempt to reclaim the seat he held for nearly three decades before resigning amid an ethics scandal earlier this year.

The winner of the Ward 2 nomination remained unclear Wednesday, with former Racine policy staffer Brooke Pinto and Foggy Bottom neighborhood commissioner Patrick Kennedy separated by 100 votes, according to unofficial returns. Mail-in ballots postmarked by Tuesday will be counted as long as they are received by June 12.

Evans was trailing badly, with about 300 votes, second to last in a eight-person field.

Both Pinto and Kennedy are 28, and George is 32. All three have embraced sweeping policy agendas to address systemic inequality, and are more left-leaning than Todd, 37, or Evans, 66, both of whom Bowser (D) and Council Chairman Phil Mendelson (D) have relied on as moderating forces.

“All of us who are in this business know that when the voters speak, we have to listen and work with the people that they send down here to city hall to do their business,” Bowser said at a Wednesday news conference.

Council member Elissa Silverman (I-At Large), who endorsed George, said the departures of Evans in January and Todd at the end of this year mark a new era in city politics.

The two men were more receptive to business interests than others on the council, skeptical of measures to reduce the influence of money in politics and resistant to liberal priorities such as lowering the voting age to 16 and decriminalizing prostitution.

“Jack and Brandon were reliable votes for policies that helped a select few, particularly those who gave political contributions and had powerful expensive lobbyists at city hall,” Silverman said. “What the change in leadership will bring is more of a people-powered focus.”

Council member Vincent C. Gray (D-Ward 7), a centrist lawmaker, and Trayon White Sr. (D-Ward 8), a swing vote who tends to lean liberal, both easily won their primaries.

Mendelson said the election results were not a “victory for the ultraprogressives,” noting that the candidates in Wards 2 and 7 running furthest to the left were lagging or defeated.

The ideological tilt of the new council won’t come fully into focus until the general election, in which a slew of independent and non-Democratic candidates are running to succeed retiring David Grosso (I-At Large), one of the city’s most liberal lawmakers.

But in the District, where the overwhelming majority of voters are registered Democrats, the winners of Tuesday’s ward-based primary contests are all but assured of victory in November.

That means Ward 4, a part of the city known for middle- and upper-income homeowners, moderate politics and deep civic engagement, will be represented by a millennial leader whose agenda includes demilitarizing the police department and decriminalizing prostitution.

Adrian Fenty won the Ward 4 seat in 2000 and, when he became mayor, anointed Bowser, a campaign staffer, to succeed him. After Bowser won the mayoral election in 2014, she backed Todd, who had been her constituent services director, to replace her on the council.

Todd, like his predecessors, focused his time in office on constituent services and supported development projects favored by the mayor and the education reform movement. He chaired a committee overseeing mayoral agencies and rarely took the lead on significant legislation.

Despite a significant cash advantage and a deep base of support from older black voters, early results showed Todd losing by 11 percentage points. He did not return calls for comment Wednesday.

In her campaign, George argued that Todd failed to be independent from Bowser and criticized his votes against a paid family and sick leave law and to overturn a minimum-wage increase for tipped workers.

Left-leaning groups coalesced behind George, who grew up in the ward and appealed to white liberal newcomers but also had credibility among longtime residents.

“Neighbors and grassroots organizations came together to make this possible and, united, we can make D.C. a more just and equitable place,” George tweeted.

Todd and his allies tried to cast her as too extreme based on her comments calling to “divest” from policing and put more resources into non-police violence interruption strategies. An independent mailer sent by Democrats for Education Reform attacked George, who worked as a juvenile prosecutor for Racine focused on youth rehabilitation and restorative justice, as wanting to “cut police officers.”

Racine, who is running for a third term as attorney general in 2022 but hasn’t ruled out shifting to a mayoral run, said George’s win shows the futility of trying to smear politicians who back criminal justice overhauls in an increasingly liberal city.

“The District voters want smart public safety policies. They are not going to fall for easy labels like ‘hard on crime’ and ‘soft on crime’ anymore,” he said.

Bill Lightfoot, a moderate former council member, said changing demographics and an influx of young white liberals are pushing the District electorate to the left. But he said Todd’s loss was not necessarily a rejection of moderate politics, noting that he was also tainted by multiple campaign-finance violations during his term.

“There’s clearly been movement among voters who want our elected officials to follow the highest standard of ethics, and Brandon and Jack were both branded with ethical violations,” Lightfoot said.

Evans, who played a key role in lifting the city from the financial mess of the 1990s and bringing Major League Baseball back to Washington, had asked voters to forgive his ethics transgressions and return him to his job representing one of the toniest stretches of the District, from Georgetown through Dupont and Logan circles to downtown.

But two years of scandal — including an FBI search of his home last year and investigations finding he violated ethics rules at the council and the Metro transit agency where he served as board chairman — proved too much to overcome.

Evans was not charged with a crime, but he resigned in January as his colleagues were preparing to expel him. Just 10 days later, he filed paperwork to again seek the seat. On the first day of early voting, the D.C. ethics board levied its largest-ever fine against him.

“I want to thank the voters and residents of Ward 2 for their support over the last 29 years and the opportunity to serve,” Evans in an interview Wednesday morning. “And now it’s a new chapter in my life, and I don’t know what that is, but I’ll be heading in a different direction.”

Neither Pinto nor Kennedy was alive when Evans first took office. Both are first-time council candidates, and either would be the city’s youngest-ever council member if they win the primary and defeat Republican Katherine Venice in November.

They were among the more-moderate candidates in the race but are to the left of Evans on criminal justice and transportation issues. They are also on the June 16 special election ballot to serve out the remainder of Evans’s term, which runs through January.

Jordan Grossman, a 34-year-old former federal and local government worker who was the most liberal candidate in the race, is several hundred votes behind Kennedy and Pinto.

Kennedy built a formidable coalition that included most local neighborhood commissioners in Ward 2, former business allies of Evans, and urbanist and ­LGBTQ activists.

“People really came to a lot of their decisions based on what was going on at the world at large,” Kennedy said. “I had several conversations at the polls where I was able to articulate a pretty community-based idea of how we can address inequities and structural racism.”

Pinto, who moved to the District six years ago for law school, had never voted in a D.C. election before. She did not enter the race until February.

Buoyed by endorsements from Racine and The Washington Post’s editorial board, she was the only candidate who did not use the city’s public financing program, enabling her to put more than $45,000 of her own money in the race.

She told voters that the 13-member council — with four female lawmakers — needed more women — and said her experience working on legislative and budget issues in Racine’s office made her best qualified.

“I’ve literally called thousands of voters, every single week,” Pinto said. “As we work to recover from covid-19, I believe it is important to have somebody with citywide legislative and budgetary experience.”