Philadelphia District Attorney Larry Krasner’s electoral landslide wasn’t the only big win Tuesday for the left in Pennsylvania.

In Pittsburgh, Mayor Bill Peduto lost his bid for a third term after coming under intense criticism last year for the city’s handling of Black Lives Matter protests. State Rep. Ed Gainey seized on progressives’ growing discontent with the mayor and defeated him in the four-candidate Democratic primary.

Gainey, who centered his campaign around racial justice, will almost certainly win the November general election and become Pittsburgh’s first Black mayor in the heavily Democratic city.

The results in Pennsylvania’s two biggest cities offered the latest evidence that the progressive left is the driving force in Democratic politics in the state, though it remains to be seen what the off-year local elections may portend for next year’s high-profile races for governor and U.S. Senate.

“After tonight let’s stop saying who can and can’t win,” State Rep. Malcolm Kenyatta, a North Philadelphia Democrat running an underdog campaign for Senate, said on Twitter as Gainey’s upset win came into focus.

Peduto was no moderate, and his defeat doesn’t fit a neat narrative. As a city councilman in 2010, he helped lead the push to ban fracking in Pittsburgh — a full decade before Sens. Bernie Sanders and Elizabeth Warren elevated the cause in national Democratic politics. In 2019, Peduto announced he would oppose the construction of any new petrochemical plants in Western Pennsylvania, enraging building trades unions that typically align with Democrats.

It was a bold statement that underscored how fighting climate change had become a central liberal cause. And it came even as most elected Pennsylvania Democrats — including Gov. Tom Wolf — supported big tax breaks for petrochemical companies, saying they create jobs and arguing natural gas would help the country transition to a greener economy.

In addition to Gainey’s campaign from the left, Peduto drew a challenge from a retired police officer who ran as a more conservative Democrat.

But analysts said there’s no question Peduto’s prospects took a hit last summer amid Black Lives Matter demonstrations, as his police department faced allegations of excessive force. Activists protested outside Peduto’s house for days after plainclothes officers arrested a demonstrator and placed the person in an unmarked van. The mayor initially said there were “restrictions” to constitutional rights but later said he had “serious concerns” about the police tactics.

And earlier this year, Peduto drew criticism from progressives for seeming to draw an equivalence on social media between the “Radical left” and “Radical right.”

“In a lot of ways he tried to have feet in both camps and he ended up not pleasing either side,” said Mike Mikus, a Pittsburgh-area Democratic strategist who wasn’t involved in the campaign. “I absolutely believe that was the turning point,” he said of the Black Lives Matter marches.

“He was somebody the progressives really liked,” Mikus said. But Peduto “seemed to have trouble over the years connecting on a personal level with a lot of these voters.”

» READ MORE: Trump is gone, so Pennsylvania progressives are thinking local: ‘That’s where all the real stuff happens’

Neither Peduto nor Gainey embraced calls to “defund the police.” But Gainey said the mayor had been too slow to reform the department in a city where about two-thirds of people who were arrested last year were Black, more than double the Black share of the population. (Pittsburgh is 65% non-Hispanic white, according to census data.)

Progressives have scored big wins in local elections in recent years in both Philadelphia and Pittsburgh, reflecting a larger national shift in the Democratic Party since Donald Trump’s 2016 victory.

The 2017 election of Krasner — a progressive reformer who campaigned against decades-long tough-on-crime orthodoxy in the DA’s Office — foreshadowed the change to come in Philadelphia. Sclerotic party machines failed to adapt, and left-wing candidates with superior campaign organizing toppled longtime incumbents or won open seats in city and state elections. Much of the same coalition that backed Krasner helped elect State Reps. Elizabeth Fielder and Rick Krajewski, State Sen. Nikil Saval, and City Councilmember Kendra Brooks of the Working Families Party.

In Western Pennsylvania, Summer Lee heralded a new era for local progressives with her 2018 primary victory over a 20-year incumbent state representative in a Pittsburgh-area district. Lee ran on a platform of racial and environmental justice and helped mobilize opposition to a proposal by U.S. Steel to drill natural gas wells at its plant in Braddock.

» READ MORE: From last year: A fight over fracking at a Pennsylvania steel mill is forcing a reckoning among Democrats

Lee, the first Black woman elected to the state legislature from Southwestern Pennsylvania, has helped elect like-minded progressives in state and local races since then, and she backed Gainey for Pittsburgh mayor.

Lee wasn’t available for comment early Wednesday, but she wrote on Twitter on Tuesday night: “Get on the team. Our Pittsburgh is big enough for you too.”

Gainey also had support from SEIU Healthcare, a labor union that represents low-wage workers and has also helped elect progressives in Philadelphia.

“I’m honored, humbled, and proud that the people of Pittsburgh have placed their faith in me by making me their Democratic Nominee for the office of Mayor,” Gainey said. “This election made history, and I’m ready to go to work building a Pittsburgh where all can belong, contribute, and succeed!”