A Pennsylvania court ordered election officials on Thursday to count undated mail-in ballots for now in a nationally watched Republican Senate primary, granting a temporary injunction to David McCormick as he trailed Dr. Mehmet Oz amid a statewide recount.
Fewer than 1,000 votes separate Mr. McCormick, a former hedge fund executive, from Dr. Oz, the celebrity physician backed by former President Donald J. Trump, in a race that could ultimately determine control of the divided Senate.
The Commonwealth Court of Pennsylvania concluded that a May 23 lawsuit by Mr. McCormick had raised sufficient claims that a state law requiring voters to hand-write the date on return envelopes for mail-in ballots could lead to their disenfranchisement.
Republicans have fought to enforce the rule, siding with Dr. Oz in the lawsuit.
In the 42-page opinion, Renée Cohn Jubelirer, the court’s president judge, directed county election boards to report two sets of tallies to the acting secretary of the commonwealth, one that includes the undated ballots and one that does not. That way, when a final decision is made on whether to accept the ballots, the judge wrote, the vote count will be readily available.
In the opinion, Judge Cohn Jubelirer said there was no question that the contested ballots had been returned by the May 17 deadline.
“The court notes that no party has asserted, or even hinted, that the issue before the court involves allegations of fraud,” she wrote. “The parties have agreed that this election was free and fair.”
A campaign spokeswoman for Mr. McCormick lauded the court order in a statement on Friday.
“We are pleased the court agrees on ensuring valid Republican votes that were signed and returned on time, as shown by their time-stamp, are counted so the party can get behind a strong nominee in the fall,” the campaign spokeswoman, Jess Szymanski, said.
Casey Contres, the campaign manager for Dr. Oz, declined to comment about the decision on Friday.
Judge Cohn Jubelirer wrote that the court’s guidance should be uniform, noting that some counties had decided to accept the undated ballots and others had not.
“Without court action, there exists the very real possibility that voters within this commonwealth will not be treated equally depending on the county in which they vote,” she wrote. “The court begins with the overarching principle that the Election Code should be liberally construed so as not to deprive electors of their right to elect a candidate of their choice.”
The treatment of undated mail-in ballots is at the heart of another legal dispute in Pennsylvania. That one is before the U.S. Supreme Court, which on Tuesday paused the counting of those ballots in a judicial race in Lehigh County, Pa., a case that could reverberate in the G.O.P. Senate primary.
Understand the Battle Over U.S. Voting Rights
Why are voting rights an issue now? In 2020, as a result of the pandemic, millions embraced voting early in person or by mail, especially among Democrats. Spurred on by Donald Trump’s false claims about mail ballots in hopes of overturning the election, the G.O.P. has pursued a host of new voting restrictions.
The Republican primary winner will face Lt. Gov. John Fetterman, the Democratic nominee, in the November election for the seat, from which Senator Patrick J. Toomey, a Republican, is retiring.
The Commonwealth Court’s action late on Thursday came two days after Judge Cohn Jubelirer heard several hours of oral arguments in Mr. McCormick’s lawsuit, in which the state and national Republican parties intervened in opposition.
They claimed that making voters write the date on the return envelopes for mail-in ballots was aimed at preventing fraud. Thomas W. King III, a lawyer for the Republican National Committee and Pennsylvania Republican Party, did not immediately respond to a request for comment on Friday.
Pennsylvania’s top election official — Leigh M. Chapman, the acting secretary of the commonwealth, who was named as defendant in Mr. McCormick’s lawsuit — supports the counting of undated mail-in ballots.
A lawyer for Dr. Oz had argued on Tuesday that there were not enough outstanding votes to change the outcome of the race. He said that the court should hold off on ruling on the ballots’ status until after the statewide recount concludes; counties have to complete the process by Tuesday and report their results to the state by Wednesday. The ballots should be set aside, the lawyer said, with counties reporting the total number but not counting the votes.
But Judge Cohn Jubelirer was not persuaded by the Oz campaign’s argument that such an approach would not cause harm, writing that “the ability to determine which votes will make a difference is an ever-changing number” during the recount stage and that waiting could further delay the election process.
Adam Liptak contributed reporting.