After George Twardy lost reelection as a Haverford Township commissioner in 2005 amid a corruption scandal and later stepped aside as the local GOP chair, a fellow Republican said Twardy didn’t have a future in Delaware County politics.

That was true. But Twardy’s political career wasn’t over.

Twardy has since moved to Philadelphia, switched parties, and built goodwill with the city’s Democratic establishment by doing free legal work for ward leaders and agreeing to wait for party approval before running for the bench, according to the city’s Democratic boss. He landed on the Court of Common Pleas last year thanks to an appointment by Democratic Gov. Tom Wolf. And he’s now well-positioned to win a Municipal Court judgeship after an endorsement from the Democratic City Committee in the May 18 primary.

From his campaign literature and website, it would be difficult to tell Twardy was ever a Republican, let alone an official involved in a high-profile scandal over the sale of a former state hospital site. Twardy admitted to a grand jury that he manipulated the sales process for political gain, but was not indicted. A lawyer speaking on Twardy’s behalf this week denied any wrongdoing.

Even Gregory Yorgey-Girdy, another Municipal Court candidate who was also endorsed by the party and has campaigned with Twardy, was unaware of his past.

“I’m actually shocked. I’m at a loss for words,” Yorgey-Girdy said after learning about Twardy’s history from a reporter.

The former Republican’s emergence as a leading Democratic candidate shows what can happen in the state’s often low-information, party-driven courthouse races. In local judicial elections, voters are often unaware of candidates’ backgrounds, and party endorsements — spread through sample ballots distributed by party ward leaders and committee people on Election Day — can be determinative. Those endorsements are typically decided behind closed doors, and insurgents have long criticized the Democratic City Committee as an old boys’ club that operates on favors rather than merit.

» READ MORE: Pennsylvania elects most judges. Here’s how the process works.

Four Democrats are running for three slots in the primary for the Municipal Court bench, which comes with a $182,000 annual salary and presides over smaller cases. Those include crimes with potential sentences of five years or less, civil suits up to $10,000, landlord-tenant disputes, and tax delinquencies of $15,000 or less.

No Republicans are running.

Barbara Thomson was the only one not endorsed by the City Committee.

“I was disappointed to hear [Twardy] wasn’t a Democrat all these years and that the party supports him, and I’ve been a loyal Democratic Party person,” said Thomson, a Chestnut Hill resident and lawyer who owns a consulting firm that works with nonprofits, government agencies, and transit authorities, including SEPTA.

Twardy did not respond to repeated interview requests, but attorney George Bochetto, speaking on his behalf, said he became a Democrat because the GOP had become increasingly conservative.

Twardy got involved in Philadelphia Democratic politics by working with the 18th Ward in Fishtown, Bochetto said. Theresa Alicea, Democratic leader of the 18th Ward, did not respond to an interview request.

“It’s not a secret that the Republican Party has at least for the last six, eight, 10 years been moving further and further right, and Judge Twardy always regarded himself as pretty much a centrist,” Bochetto said. “Over time he just started identifying more with the values and the objectives that the Democrats were espousing.”

Bob Brady, the former congressman who chairs the Democratic City Committee, said Twardy was vetted by the governor’s office and state Senate when he was confirmed to fill a vacancy on the Common Pleas Court.

Twardy, he said, earned the party’s goodwill by offering pro bono legal work to Democratic ward leaders, committee people, and constituents.

“He’s a qualified person. We support qualified people,” he said.

Additionally, Brady said, Twardy gained favor by agreeing to run when the party could fit him in to one of its endorsement slots. Initially, Twardy wanted to run for Common Pleas Court last election cycle, but agreed to step aside, Brady said. This time around, he again wanted to run for Common Pleas, but settled for Municipal Court, which handles less significant cases, to help the party form its slate.

“He graciously withdrew,” Brady said. “He was supportive of the Democratic Party.”

The Working Families Party, which often supports insurgent progressive candidates running in Democratic primaries, decried the City Committee’s support for Twardy.

“Twardy is a prime example of the type of corruption we don’t want in the Philadelphia court system,” said Nicolas O’Rourke, the group’s Pennsylvania organizing director. “No evidence has shown George Twardy to be any less corrupt than he was as Haverford GOP head.”

Twardy lost reelection in 2005 amid uproar over a contentious redistricting battle and the hospital site sale but continued in his role as chair of the Haverford GOP. Two years later, a grand jury report detailed how Twardy and fellow commissioner Fred C. Moran, who was convicted on bribery charges, “circumvented any notion of an appropriate public sale process” by “secretly” giving their preferred firm information about a competitor’s purchase offer.

Twardy aggressively pursued the sale of the former state hospital site, a blight on Haverford for years, in order to fulfill a campaign promise, Bochetto said.

“He may have done it in a way that some people — particularly the opposing party, the Democrats, who are very partisan out there — thought was too aggressive, but you’ve got to remember the times that this was in. This was a burning issue,” Bochetto said of the local pressure to redevelop the site. “The whole situation has been analyzed and reanalyzed and investigated and reinvestigated, and no one has ever said that Judge Twardy did anything improper or untoward, save for perhaps there were a couple of meetings that people were critical of that should have been in public view.”

Fellow Republicans called on Twardy to resign after the bombshell report. Instead, he declined to run for reelection as chair in 2008, citing family reasons.