Rudy Giuliani makes series of blunders in court as he argues US election was stolen from Trump
Over the next few hours he fiddled with his Twitter account, forgot which judge he was talking to and threw around wild, unsupported accusations about a nationwide conspiracy by Democrats to steal the election.
The ex-federal prosecutor has taken over Mr Trump's efforts to overturn the election results.
During the hearing, he needled an opposing lawyer, calling him "the man who was very angry with me, I forgot his name."
He also mistook the judge for a federal judge in a separate Pennsylvania district who rejected a separate Trump campaign case - and tripped himself up over the meaning of "opacity."
"In the plaintiffs' counties, they were denied the opportunity to have an unobstructed observation and ensure opacity," Mr Giuliani said. "I'm not quite sure I know what opacity means. It probably means you can see, right?"
"It means you can't," said U.S. District Judge Matthew Brann.
"Big words, your honour," Mr Giuliani said.
At times, the Philadelphia lawyer working alongside Mr Giuliani, Linda Kerns, took over in answering Brann's questions.
At one point, an opposing lawyer, Mark Aronchick, disputed Mr Giuliani's repeated contentions that it was illegal for counties to help people vote.
"I don't expect that he would know the Pennsylvania election code," Mr Aronchick said, suggesting - without saying it - that Mr Giuliani was an unprepared out-of-towner.
The Trump campaign is seeking to prevent Pennsylvania from certifying its election. The lawsuit is based on a complaint that Philadelphia and six Democratic-controlled counties in Pennsylvania let voters make corrections to mail-in ballots that were otherwise going to be disqualified for a technicality, like lacking a secrecy envelope or a signature.
It is not clear how many ballots that could involve, although some opposing lawyers say it is far too few to overturn the election result. President-elect Joe Biden won the state by more than 70,000 votes.
On Tuesday, opposing lawyers asked Judge Brann to throw out the case, calling the evidence cited "at best, garden-variety irregularities" that would not warrant undoing Pennsylvania's election results, which delivered the White House for Biden.
Once a hard-nosed federal prosecutor who made a name for himself going after New York mobsters in the 1980s, Mr Giuliani had not appeared in court as an attorney since 1992, according to court records.
Following the November 3 election, Mr Giuliani was famously seen at Trump campaign press conference held held in the car park of a garden centre in Philadelphia called Four Seasons Total Landscaping, which Mr Trump appeared to have confused with a luxury hotel.