HARRISBURG, Pa. (AP) — Challenger Corey O’Connor ousted Pittsburgh Mayor Ed Gainey in Tuesday’s Democratic primary election, beating an incumbent in a race that hinged on how Gainey was handling city finances, affordable housing and public safety.

O’Connor is all but assured of winning November’s general election against a low-profile Republican nominee in a city that hasn’t elected a GOP mayor in nearly a century.

The race for Pittsburgh mayor hinged on local issues, driven by unhappiness in some quarters with Gainey’s management, rather than the questions dividing the national Democratic Party. On the other side of the state, progressive stalwart Larry Krasner won the Democratic primary for Philadelphia district attorney driven by nationalized themes of criminal justice reform and Krasner’s positioning himself as a guardian of the city against President Donald Trump’s conservative agenda.

O’Connor, the Allegheny County controller, is the son of a former Pittsburgh mayor and had won the local party’s endorsement over Gainey, who had allied himself with progressives.

Gainey, the city’s first Black mayor and someone who grew up in subsidized housing, beat predecessor Bill Peduto in 2021’s primary campaign. He portrayed himself as someone who sides with regular people and as a “mayor that’s going to fight for you” when the Trump administration threatens the city.