ALLENTOWN, Pa. — A Pennsylvania mayor was convicted Thursday of selling his office to campaign donors in a wide-ranging scheme meant to fuel his political ambitions for statewide office.

Jurors at the federal corruption trial of Allentown Mayor Ed Pawlowski convicted him of 47 of the 54 charges he faced, a verdict that will force the Democrat from office and end his 12-year tenure as leader of Pennsylvania’s third-largest city.

Pawlowski, who began a fourth term in January, cried in the courtroom after the verdict was read, and his wife collapsed in a hallway.

A co-defendant, lawyer Scott Allinson, was convicted of bribing Pawlowski for legal work for his firm.

Prosecutors said Pawlowski masterminded a scheme to rig city contracts for legal, engineering, technology and construction work, all in a bid to raise money for his statewide political campaigns. Pawlowski ran for governor in 2014 and U.S. Senate in 2015, suspending the latter campaign days after the FBI raided City Hall.

He was convicted of charges that include conspiracy, bribery, fraud, attempted extortion and lying to the FBI.

The jury “held Mayor Pawlowski accountable for selling his office to the highest bidder to fund his personal ambitions,” U.S. Attorney Louis D. Lappen said in a statement.

The mayor’s political consultants cooperated with the government and recorded hundreds of conversations with him. Several city workers and vendors who pleaded guilty testified against Pawlowski.

His attorney, Jack McMahon, told jurors it’s not unusual for a politician to solicit campaign contributions from government contractors. He contended that Pawlowski had been set up by the mayor’s political advisers, Mike Fleck and Sam Ruchlewicz, who made secret recordings that helped form the basis of the prosecution’s case. Fleck pleaded guilty; Ruchlewicz wasn’t charged.

The defense also sought to use the government tapes to its own advantage, playing for jurors a June 2015 conversation in which the mayor — unaware he was being recorded — complained about an engineering executive who’d been pressuring him for city work. “I’m not a pay-to-play guy,” Pawlowski said on the recording.

Pawlowski, who won re-election in November while under indictment, took the stand in his own defense and insisted he’d done nothing wrong.

The Chicago native was Allentown’s economic development chief before taking office as mayor in January 2006. The city’s moribund downtown was transformed on his watch, with valuable state tax incentives producing a new hockey arena, gleaming office buildings and upscale apartments.