HARRISBURG, Pa. (AP) — Harrisburg Mayor Linda Thompson lost the Democratic nomination for a second term Tuesday as challenger Eric Papenfuse emerged as the winner of a fiercely competitive primary contest.

In other mayoral nomination contests, Democrats tapped veteran city Councilman William Peduto as their standard-bearer in Pittsburgh, city Tax Collector Bill Courtright as their nominee in Scranton and Kim Bracey for a second term in York.

In the only statewide nomination race, Allegheny County Judge Jack McVay Jr. won the Democratic nomination for an open seat on the Superior Court, defeating Philadelphia Municipal Court Judge Joseph C. Waters Jr.

Philadelphia Democrats gave city Controller Alan Butkovitz the nod for a third term.

Democrats also retained two vacant seats in the state House of Representatives in special elections that were held Tuesday. Attorney Daniel Mill won the 42nd District seat in Allegheny County while Kevin Schreiber, a York city official, captured the District 95 seat in York County.

Thompson, Harrisburg’s first African-American mayor and first female mayor, has had a rocky tenure as chief executive of the financially troubled state capital, the only municipality under a state takeover. She has worked with the city’s receiver to negotiate a recovery plan that avoids a bankruptcy filing.

“The people spoke and I respect what the people said tonight,” she said after conceding Tuesday night.

Papenfuse, who is expected to face at least one independent opponent in the general election, celebrated with supporters at the Harrisburg bookstore that he founded, the Midtown Scholar.

“This city has voted for change in a big way,” he said. “This city is ready for change and ready to be united.”

Peduto and Courtright both won four-way races that resulted from decisions by the incumbent Democratic mayors — Pittsburgh’s Luke Ravenstahl and Scranton’s Chris Doherty — not to seek re-election. Also Tuesday, Scranton Republicans picked financial consultant Garett Lewis as their nominee in the Nov. 5 general election.

Butkovitz overcome two challengers in his bid for a third four-year term as Philadelphia city controller— tax reform advocate Brett Mandel and former city law department attorney Mark Zecca.

In the race for Superior Court, McVay, 56, who is serving his sixth year in Allegheny County’s family-court division, will face Vic Stabile, a Harrisburg lawyer who was unopposed for the Republican nomination.

Though the other primaries were local, they were the first step toward choosing judges, school board members and municipal officials who make decisions about public schools, local taxes, criminal justice, police protection, road repairs, land use and other governmental actions that can have serious consequences for residents.

“These are the elections that really touch you the most,” said Jerry Feaser, the director of elections and voter registration in Dauphin County, which includes Harrisburg, the county seat and the state capital.

(© Copyright 2013 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)

Watch & Listen LIVE