HARRISBURG, Pa. (AP) — Democratic Sen. Bob Casey of Pennsylvania conceded his reelection bid to Republican David McCormick on Thursday, as a statewide recount showed no signs of closing the gap and his campaign suffered blows in court in its effort to get favorable ballots counted.

Casey’s concession comes more than two weeks after Election Day, as a grindingly slow ballot-counting process became a spectacle of hours-long election board meetings, social media outrage, lawsuits and accusations that some county officials were openly flouting the law.

Republicans had been claiming that Democrats were trying to steal McCormick’s seat by counting “illegal votes.” Casey’s campaign had accused of Republicans of trying to block enough legitimate votes to prevent him from pulling ahead and winning.

In a statement, Casey, a stalwart of Pennsylvania’s Democratic establishment and the state’s longest serving Democrat ever in the Senate, said he had just called McCormick to congratulate him.

“As the first count of ballots is completed, Pennsylvanians can move forward with the knowledge that their voices were heard, whether their vote was the first to be counted or the last,” Casey said.

Casey’s campaign said the last of the ballots cast before polls closed on Nov. 5’s Election Day had finally been counted Thursday.

The Associated Press called the race for McCormick on Nov. 7, concluding that not enough ballots remained to be counted in areas Casey was winning for him to take the lead.

As of Thursday, McCormick led by about 16,000 votes out of almost 7 million ballots counted.

That was well within the 0.5% margin threshold to trigger an automatic statewide recount under Pennsylvania law.

But no election official expected a recount to change more than a couple hundred votes or so, and Pennsylvania’s highest court dealt Casey a blow when it refused entreaties to allow counties to count mail-in ballots that lacked a correct handwritten date on the return envelope.

Casey in the meantime had won efforts to get counties to tabulate thousands of provisional ballots that might otherwise have been thrown out because of an error by an election worker. That included voters whose registrations hadn’t been properly processed, the campaign said.

But the campaign lost other efforts to get counties to count ballots that were disqualified over garden-variety errors that voters made, like not signing a provisional ballot in two places or not putting the ballot into an inner “secrecy” envelope.

Republicans will have a 53-47 majority next year in the U.S. Senate.

McCormick, 59, recaptured a GOP seat in Pennsylvania after Republicans lost one in 2022, paying off a bet that party brass made when they urged McCormick to run and consolidated support behind him. It was McCormick’s second time running, after he lost narrowly to Dr. Mehmet Oz in 2022’s GOP primary.

McCormick, the former CEO of the world’s largest hedge fund, drew on tens of millions of dollars in campaign cash from allies from across the worlds of hedge funds and securities trading to help make the race the nation’s second-most expensive in the campaign cycle.

___

Follow Marc Levy at twitter.com/timelywriter