Appeal court judges have sharply questioned Donald Trump's argument that former presidents should be entitled to immunity from criminal prosecution.
In a landmark case, Mr Trump's lawyers said his time in office protects him from charges connected to his alleged effort to overturn the 2020 election.
But the justice department argued the presidency was not above the law.
Mr Trump, the frontrunner for the Republican presidential nomination, left the Iowa campaign trail to attend.
On Tuesday, his motorcade entered and left the Washington DC courthouse through a rear garage. Mr Trump sat silently with his attorneys during the 75-minute hearing.
Speaking afterwards from the Waldorf-Astoria hotel - which was until recently a Trump hotel - he said his side was "doing very well" in the case and maintained he was facing political persecution from the Biden administration.
The Republican is accused by special counsel Jack Smith of trying to overturn Democratic President Joe Biden's election victory in 2020.
Mr Trump, 77, says he should not face criminal charges because he was acting as president at the time. He has for years cited presidential immunity while battling civil and criminal cases.
Whichever way the appeals judges rule, the case is widely expected to end up at the US Supreme Court, where conservatives hold a 6-3 majority.
The case could have a profound effect on the future of the American presidency and what is allowable by an individual who holds the office.
It may also delay Mr Trump's criminal trial for weeks, if not months, during a 2024 political campaign in which the former real estate mogul is a leading contender.
As soon as the case began, the three judges on the US Court of Appeals for the DC Circuit - Karen Henderson, J Michelle Childs and Florence Pan - asked probing questions about the implications of their decision.
Judge Pan, a Biden appointee, sounded particularly sceptical. She asked Mr Trump's attorney, Dean John Sauer, whether he would contend that a president could sell presidential pardons and state secrets, or order Navy SEALs - the elite US special forces - to assassinate a political rival, without being concerned about criminal prosecution.
Mr Sauer's argument boiled down to the idea that a president who is not convicted for impeachment by Congress cannot be subject to criminal proceedings. Mr Trump, he noted, was impeached by the House of Representatives, but never convicted by the Senate.
However, James Pearce, the government's attorney, said such a precedent could easily be short-circuited and undermine Congress and any potential criminal proceedings. All a sitting president would have to do is resign before the legislature is able to begin impeachment proceedings to avoid prosecution, he said.
"What kind of world are we living in if... a president orders his SEAL team to assassinate a political rival and resigns, for example, before an impeachment - not a criminal act," he said.
"A president sells a pardon, resigns or is not impeached? Not a crime," Mr Pearce added. "I think that is an extraordinarily frightening future."
Mr Sauer contended that prosecuting a president for his actions in office could paralyse government, particularly the executive branch. He said authorising "the prosecution of a president for his official acts would open a Pandora's Box from which the nation may never recover".
He posed the hypotheticals that George W Bush could be prosecuted for "giving false information to Congress" to make the case for the invasion of Iraq, and that Barack Obama could face charges "for allegedly authorising drone strikes targeting US citizens located abroad".
While the judges seemed open to the government's arguments, they also expressed concern that a broad ruling against Mr Trump's immunity claim could "open the floodgates" to "tit-for-tat" prosecutions.
The answer may not be immediately clear, however.
The decision on Mr Trump's appeal will determine how one of the most high-profile trials in the US will proceed. It could also have major implications for the office of the presidency.
The immunity defence has already been rejected by US District Court Judge Tanya Chutkan. In December, she ruled that having served as president does not entitle one to a "lifelong 'get-out-of-jail-free' pass".
In legal filings ahead of this hearing, Mr Smith, the special counsel, warned that a failure to allow Mr Trump to be prosecuted "threatens to license presidents to commit crimes to remain in office".
In a fundraising email on Wednesday, Mr Trump said President Biden and Mr Smith were "attempting to strip" him of his rights.
A poll by CBS News suggests most Americans believe Mr Trump should not be protected from prosecution for actions he took while president.
The criminal trial in this election fraud case is scheduled for 4 March, but is on hold pending a ruling on the immunity claim.
The trio of judges on the DC appeals court comprise two appointed by Democratic presidents and one by a Republican.
Legal observers saw long odds for Mr Trump in this appeal.
"I think it's fairly certain that the three-judge panel is probably going to rule against him on this particular issue," said Hans von Spakovsky, legal analyst for the Heritage Foundation, a conservative think tank.
He expected Mr Trump to appeal to the highest court in the land in the event of a loss.