It was Rudolph W. Giuliani’s first appearance in federal court since the early 1990s, and by late afternoon Tuesday, it was clear that U.S. District Judge Matthew W. Brann was losing patience with President Trump’s personal attorney.

Trump is seeking to stop the certification of Pennsylvania’s vote in the Nov. 3 election, alleging that Republican voters in the state were illegally disadvantaged because some Democratic-leaning counties allowed voters to fix errors on their mail ballots. Two voters named as co-plaintiffs with Trump’s campaign in the long-shot lawsuit had their ballots voided and allege that they were not given a chance to correct their mistakes.

“You’re alleging that the two individual plaintiffs were denied the right to vote,” Brann said. “But at bottom, you’re asking this court to invalidate more than 6.8 million votes, thereby disenfranchising every single voter in the commonwealth. Can you tell me how this result can possibly be justified?”

In response, Giuliani said that Trump’s campaign was seeking only to throw out about 680,000 ballots cast in Philadelphia and Pittsburgh, because, he said, Republican observers were not allowed to watch them being counted.

But Trump’s attorneys had removed legal claims relating to that issue in an amended version of the lawsuit they filed over the weekend, the judge reminded him.

“The poll-watching claims were deleted,” Brann told Giuliani. “They’re now not before this court, so why should I consider them now?”

Giuliani — who in the days before the hearing had falsely denied that the claims were deleted — was forced to acknowledge that they had been. He said that the campaign would file a third version of its lawsuit restoring the allegations.

Throughout the five-hour hearing in federal court in Williamsport, Pa., Giuliani — a former U.S. attorney and mayor of New York — came under heavy criticism from opposing counsel and appeared unable to answer several questions from Brann about legal technicalities.

Brann asked what standard of review he should apply in the case. “I think the normal one,” Giuliani replied.

“Maybe I don’t understand what you mean by strict scrutiny,” Giuliani said at another point.

At a different moment, Giuliani said: “I’m not quite sure what ‘opacity’ means. It probably means you can see.”

The judge responded: “It means you can’t.”

In a heated 45-minute speech delivered over a patchy telephone link, Mark Aronchick, an attorney representing several Pennsylvania counties, said that Giuliani was ignorant of the law, living in “some fantasy world” and pushing wild allegations that were “disgraceful in an American courtroom.”

Aronchick concluded by urging Brann: “Dismiss this case. Please, dismiss this case. So we can move on.”

Brann declined to do so, setting a deadline of 5 p.m. Wednesday for the president’s team to file a motion opposing the election officials’ attempt to dismiss the lawsuit.

This, too, appeared to confuse Giuliani, who asked if the judge was inviting him to file the retooled third version of the lawsuit that he’d promised earlier.

“This is a brief in opposition to their motion to dismiss,” Brann replied.

“Oh!” Giuliani said. “Oh, sure, absolutely.”

Giuliani did not immediately respond to a request for comment.

The president’s attorney opened his appearance in court with a broad claim: that the Trump campaign was alleging “widespread nationwide voter fraud.”

But he was unable to provide evidence of any fraud, and he said later under questioning from Brann that the lawsuit did not allege fraud as a matter of law and that “this is not a fraud case.”

Without citing any evidence, Giuliani painted a sinister picture of Democratic Party machines conspiring to fix the election against Trump. He alleged without proof that mail ballots counted after Election Day in cities such as Philadelphia and Pittsburgh were somehow faked to help Democrat Joe Biden make up a lead that Trump held among in-person voters on Election Day, whose ballots were counted first.

Addressing the one formal claim that remained in Trump’s lawsuit, Giuliani argued that Trump’s campaign and Republican voters had their constitutional rights violated when the Democratic-leaning counties invited voters to “cure,” or fix, defective ballots.

“The Trump campaign has been treated totally differently than the Bush campaign,” Giuliani said, misstating the name of President-elect Biden.

Attorneys for state and county authorities denied that charge, saying that Pennsylvania law allowed officials to contact voters with defective ballots, and arguing at length that Trump’s campaign had no standing to bring its lawsuit in federal court.

The defense attorneys repeatedly criticized Giuliani for basing his arguments on the discarded allegations that Republican observers were not allowed to watch ballots being counted, noting that three formal counts and a request for action over the issue had been erased in the revised version of the lawsuit.

“Mr. Giuliani is talking about another case, not the case before your honor,” Aronchick said. Daniel Donovan, an attorney for Pennsylvania Secretary of State Kathy Boockvar (D), said Giuliani was focusing on allegations that had been “deleted, deleted, deleted, deleted.”

While the hearing was taking place, the Pennsylvania Supreme Court ruled against Trump in a separate case on the count observers, holding that Philadelphia authorities had given reasonable access to representatives from Trump’s campaign.

In his own remarks, Donovan said that with its allegation about ballot-curing, the Trump campaign was ultimately arguing that “certain ballots should not have been counted.” He noted that there was “no claim of voter fraud” in Trump’s complaint.

“There is no claim in the complaint that any qualified Pennsylvania voter cast more than one ballot that was counted,” Donovan said. “There is no claim that any qualified voter who cast a mail-in ballot had their vote wrongly rejected. There is no claim that anyone not eligible to vote in fact voted.”

Biden has been projected the winner of Pennsylvania and leads Trump in the state by more than 74,000 votes. Officials in the state are continuing to count outstanding ballots. Counties are due to file their final tallies to state authorities by Nov. 23.

Trump’s campaign sued Boockvar and six counties where Biden defeated Trump. Lawyers for counties involved have said that the dispute about ballot-curing was unlikely to affect enough votes to change the outcome. Montgomery County, which Biden won by more than 130,000 votes, has said that fewer than 100 ballots are implicated.

But Linda Kerns, an attorney for Trump, claimed otherwise in court on Tuesday. “If everyone had had a chance to cure, it’s very likely that the results would have been very, very different,” said Kerns, who did not provide evidence.

Cliff Levine, an attorney representing the Democratic Party in the case, told The Washington Post on Sunday that Trump’s team was “suing the wrong counties” and ought to redirect its legal challenge. “They should be suing the counties that didn’t allow their voters to cure the defects,” he said.

Giuliani’s appearance in the case came after Trump’s team cycled through multiple other attorneys. The president was initially represented in the case by two attorneys from the firm Porter Wright Morris & Arthur, who withdrew last week. Tim Murtaugh, the Trump campaign’s communications director, said that the firm had “buckled” under pressure from opponents of the president’s effort to challenge the election results. Two more attorneys representing Trump’s campaign in the case withdrew on Monday.

Kerns also sought to pull out, but Brann declined to let her, saying at Tuesday’s hearing that he needed a lawyer involved in the case from the start to be present to answer his questions.

Marc Scaringi, a lawyer based in Harrisburg, Pa., who is a conservative talk-radio host, also joined Trump’s team on Monday. Earlier this month, Scaringi voiced skepticism about whether Trump’s legal campaign could change the outcome of the election.

“At the end of the day, in my view, the litigation will not work,” Scaringi said Nov. 7 on iHeartRadio. “It will not reverse this election.” A blog post on the website of Scaringi’s firm, which described Biden as the president-elect, was removed after Scaringi’s appointment to Trump’s legal team was announced.