PHILADELPHIA (WPVI) -- A ballot recount is underway in Philadelphia and across Pennsylvania as the result of the U.S. Senate race in the state remains up in the air.
Republican challenger Dave McCormick led incumbent Democratic Sen. Bob Casey by about 17,000 votes out of almost 7 million ballots counted as of Monday. That is inside the 0.5% margin threshold to trigger an automatic statewide recount under state law.
At 8 a.m. Wednesday, the ballot counting machines at the elections warehouse in Northeast Philadelphia were fired up.
"We are doing an extra check this time, because of the closeness of the race for U.S. Senate," says Philadelphia City Commissioner Seth Bluestein.
Each ballot is recounted on a different machine than it went through on November 5.
"On election night, we know what ballots were run on which machine, so these will be run on a different machine," said Philadelphia City Commissioner Omar Sabir.
One type of ballot that will not be counted is a mail-in vote with no date or an incorrect date on the outer envelope.
The Pa. Supreme Court made that ruling on Monday, though some city commissioners disagree with the decision.
"If we know we got a mail-in ballot on time, that makes the date written on the envelope immaterial," said Philadelphia City Commissioner Lisa Deeley.
A total of 607 ballots fall into that category in Philadelphia.
The recount results from Philadelphia will be announced on Monday, November 25.
In Bucks County, the recount also started on Wednesday. Elections officials expect to be done with the vast majority of ballots by the end of the day.
Montgomery County has also started recounting ballots and expects results by the end of the week.
The Pa. Supreme Court's ruling this week is a win for McCormick. The Democratic-majority high court's order reiterates the position it took previously that the ballots shouldn't be counted in the election, a decision that Republicans say several Democratic-controlled counties nevertheless challenged.
In a statement, Gov. Josh Shapiro, a Democrat, said a lack of legal clarity had surrounded the ballots, putting county officials in a position where they were "damned if they did and damned if they didn't - likely facing legal action no matter which decision they made on counting."
It comes amid a gust of fresh litigation in recent days filed by both campaigns, contesting the decisions of about a dozen counties over whether or not to count thousands of provisional ballots.
Casey's campaign says the provisional ballots shouldn't be rejected for garden-variety errors, like a polling place worker forgetting to sign it. Republicans say the law is clear that the ballots must be discarded.
Statewide, the number of mail-in ballots with wrong or missing dates on the return envelope could be in the thousands.
The Associated Press called the race for McCormick last week, though Casey has not conceded.
ABC News has not yet projected a winner in this race.
The Associated Press contributed to this report.