RICHMOND — Appeals court judges appeared divided Thursday about whether to take the extraordinary step of dismissing midstream a novel lawsuit accusing President Trump of illegally profiting from foreign and state government visitors to his hotel in downtown Washington.

The U.S. Court of Appeals for the 4th Circuit was taking a second look at the lawsuit from the top lawyers for Maryland and the District of Columbia, one of a set of emoluments cases alleging the president’s private business transactions violate the Constitution’s anti-corruption ban.

Trump’s lawyer told a full complement of 15 judges that it is “clear and indisputable” that the president cannot be sued unless such a lawsuit is expressly authorized by Congress.

In response, Judge James A. Wynn Jr. asked what else could be done to “remedy a president who openly and without any reservation violates the emoluments clause?”

“He is above the law?” Wynn asked.

“That is not correct,” replied Justice Department lawyer Hashim Mooppan, who added later that the president is being “penalized for holding office by making him divest his assets.”

Throughout the two-hour argument, Judge J. Harvie Wilkinson III repeatedly said he was prepared to dismiss the unprecedented case, saying there is no “direct evidence that the president has directly harmed anyone.”

“There’s no history that authorizes it. There’s no precedent that authorizes it,” he said of the lawsuit, calling it “the worst of the cases that are springing up like jimson weed against the president in this environment.”

The emoluments cases are distinct from another set of cases, now pending at the U.S. Supreme Court, that seek access to Trump’s financial and tax records through subpoenas from Congress and New York prosecutors.

Trump resigned from his business when he became president but he still owns it and can benefit from it financially. His sons Donald Trump Jr. and Eric Trump run the company. The case centers on the president’s hotel in Washington, where foreign governments, including Saudi Arabia, Kuwait and Bahrain, have booked rooms and events since Trump entered the White House.

No matter how the appeals court rules, the case could eventually reach the Supreme Court. But Maryland Attorney General Brian E. Frosh (D) and D.C. Attorney General Karl A. Racine (D) suggested after the hearing Thursday that another resolution outside of court is possible.

The president’s sons announced in October that the company would try to sell the hotel’s lease. Frosh and Racine said a sale — as long as the buyer was not a state or foreign government — would be the end of their case. That would represent “a victory for the United States Constitution,” Racine said at a news conference with Frosh.

In the first round at the 4th Circuit, a three-judge panel unanimously dismissed the lawsuit and said the attorneys general did not have legal grounds, or standing, to bring the case. That ruling put on hold more than a dozen subpoenas for Trump’s closely held financial records and other documents from the president’s private entities. The subpoenas are targeted to determine which foreign and state government officials have paid the Trump Organization and how much.

This time, 15 judges heard the arguments at the request of the attorneys general. The rare session before the full court Thursday underscores the significance of the case concerning little-tested language in the Constitution that bars presidents from taking payments, benefits or “emoluments” from foreign governments or individual states.

The Richmond-based court, which hears appeals from Maryland among other states, is reviewing a ruling from a District Court judge in Greenbelt who allowed the case to move forward and adopted a broad definition of the ban to include any “profit, gain, or advantage” received “directly or indirectly” from foreign, federal or state governments.

While a majority of 4th Circuit judges were nominated to the bench by Democratic presidents, the court now includes three judges nominated by Trump.

At least four judges voiced skepticism that the appeals court should step in to order an immediate dismissal before the litigation is resolved at the District Court level.

“You’re asking for extraordinary relief,” Judge Diana Gribbon Motz told the Justice Department attorney.

Judge Pamela A. Harris called the president’s request an “incredibly drastic remedy.”

Judges Stephanie Thacker and Barbara Milano Keenan raised similar concerns.

Trump’s Justice Department lawyers say the president is not violating the emoluments clauses because they bar only payments in exchange for official action or as part of an employment relationship — not regular business transactions. The Trump Organization also donates profits from foreign governments to the U.S. Treasury.

The attorneys general say the president’s receipt of emoluments generates an unlawful competitive advantage for the Trump hotel that vies for business with similar venues in the District and the Maryland suburbs close to Washington. They want the court to order the president to stop accepting the payments.

Loren L. AliKhan, the D.C. solicitor general, told the court that the two constitutional provisions are clear and designed to ensure that “foreign and domestic officials cannot ingratiate themselves” with the president.

“We are on firm footing,” she said. “Other courts have not hesitated to restrain unconstitutional action by federal officers.”

In new court filings, the attorneys general point to recent revelations to bolster claims that foreign officials seek out Trump’s venues to curry favor with the president. In a phone call with Trump in July that is at the heart of the impeachment proceedings, Ukraine’s president bragged about having stayed at Trump Tower during his visit to New York.

Earlier this week, the federal appeals court in Washington heard a similar challenge brought by more than 200 Democrats in Congress to the president’s business affairs involving foreign officials. Lawmakers in their case point to the emoluments provision that says the president must obtain permission from Congress before accepting any payment or benefit from a foreign government.

In a third case in New York, brought by Trump’s hospitality-industry competitors, the U.S. Court of Appeals for the 2nd Circuit in September said a lower-court judge had improperly thrown out the case in late 2017. Trump has asked the full 2nd Circuit to rehear the case — a request that is pending.