HARRISBURG, Pa. (AP) — The national and state Republican parties are taking the same side as celebrity heart surgeon Dr. Mehmet Oz in Pennsylvania’s neck-and-neck GOP primary contest for U.S. Senate and opposing a lawsuit that could help former hedge fund CEO David McCormick close the gap in votes.

The court battle could go to the U.S. Supreme Court. McCormick’s lawsuit was filed late Monday, less than 24 hours before Tuesday’s 5 p.m. deadline for counties to report their unofficial results to the state.

READ MORE: Montgomery County Officer Grazed By Bullet During Philly’s 4th Of July Fireworks Feels ‘Lucky’ To Walk Away From Incident

In it, McCormick asked the state Commonwealth Court to require counties to obey a brand-new federal appeals court decision and promptly count mail-in ballots that lack a required handwritten date on the return envelope.

Oz, who is endorsed by former President Donald Trump, has pressed counties not to count the ballots and the Republican National Committee and state GOP said they would go to court to oppose McCormick.

In a statement, the RNC’s chief counsel, Matt Raymer, said “election laws are meant to be followed, and changing the rules when ballots are already being counted harms the integrity of our elections.”

McCormick is doing better than Oz in mail-in ballots and has insisted that “every Republican vote should count.” McCormick’s campaign chair, James Schultz, lashed out at the state party chairman, Lawrence Tabas, saying Tabas “cares so little” about Republicans who voted for McCormick.

Tabas is supposed to “grow GOP voters and bring the party together, not to cast them aside and drive wedges,” Schultz said.

Meanwhile, Tuesday, Gov. Tom Wolf’s administration issued guidance to counties saying that any ballots without dates must be counted, citing the 3rd U.S. Circuit Court of Appeals’ decision from Friday.

But it also said counties should keep those ballots separate — an acknowledgment that lawyers for defendants in the federal appeals court case said they will appeal to the U.S. Supreme Court.

McCormick’s lawsuit is the first — but likely not the last — lawsuit in the contest between Oz and McCormick.

Oz led McCormick by 997 votes, or 0.07 percentage points, out of 1,341,184 ballots reported by the state as of mid-day Tuesday morning.

READ MORE: All Adoption Fees $5 At Philadelphia PSPCA This Saturday

The race is close enough to trigger Pennsylvania’s automatic recount law, with the separation between the candidates inside the law’s 0.5% margin. The Associated Press will not declare a winner in the race until the likely recount is complete. That could take until June 8.

Oz and McCormick are vying for the nomination to take on Democratic nominee John Fetterman in a presidential battleground contest that is expected to be among the nation’s most competitive races this fall. The seat is open because two-term Republican Sen. Pat Toomey is retiring, creating the Democrats’ best opportunity to pick up a seat in the closely divided Senate.

It’s not clear how many mail-in ballots that lack a handwritten date have been received by counties. Although he trails the vote count, McCormick has been doing better than Oz among mail-in ballots.

Ruling in a separate case late Friday, the 3rd U.S. Circuit Court of Appeals said the state election law’s requirement of a date next to the voter’s signature on the outside of return envelopes was “immaterial.” The lawsuit emerged from a county judicial election last year, and the three-judge panel said it found no reason to refuse counting the ballots in that race.

The ruling went against the position that Republicans in Pennsylvania have taken in courts repeatedly in the past to try to disqualify legal ballots cast on time by eligible voters for technicalities, such as lacking a handwritten date.

The state law requires someone to write a date on the envelope in which they mail in their ballots. However, the envelope is postmarked by the post office and timestamped by counties when they receive it.

In a court filing Tuesday urging the court to act, McCormick’s lawyers wrote that the date the voter filled out the ballot envelope has nothing to do with whether they are qualified to vote or whether the ballot was cast on time.

The law does not even require the voter to write down the precise date they filled out the envelope or help prevent any hypothetical act of fraud, McCormick’s lawyers wrote.

“In short, enforcing the dating requirement serves only one purpose—to gratuitously disenfranchise qualified Pennsylvania voters who have cast otherwise valid ballots on a timely basis,” they wrote.

MORE NEWS: Philadelphia Zoo Giving Visitors Chance To Feed Giraffes

(©Copyright 2022 by The Associated Press. All Rights Reserved.)