The 4th Circuit Court of Appeals threw out Wednesday a lawsuit filed by the Maryland and D.C. attorneys general accusing President Trump of violating the Constitution’s Emoluments Clause.

The three-judge panel found that the state attorneys general lacked standing to sue over the alleged emoluments violation.

The appeals court heard arguments in the case in March, after Trump filed an emergency appeal of a Maryland federal judge’s decision to allow the case to proceed. Trump had also filed for writ of mandamus against the judge to halt discovery in the matter. The appeals court fulfilled both requests, dismissing the complaint with prejudice.

“The District and Maryland’s interest in enforcing the Emoluments Clauses is so attenuated and abstract that their prosecution of this case readily provokes the question of whether this action against the President is an appropriate use of the courts,” the court wrote in its ruling.

The panel also hit out at the federal judge who refused to dismiss the case, saying that he “erred so clearly.” The appellate judges chastised the lower court for “relying on its belief that it was unquestionably correct and therefore that there existed no substantial ground for difference of opinion.”

The appeals court noted that writs of mandamus “are rarely given,” but then accused the lower court judge of issuing a ruling that was “not ‘guided by sound legal principles,’ but by ‘whim.’”

All three judges on the panel who heard the case at oral arguments in March were Republican appointees, and expressed skepticism of the case during the hearing.

While the appeals court decision was focused on the state attorneys general lacking standing to sue and avoids the substance of the alleged emoluments violation, its language and tone suggests a deep skepticism toward the merits of the case that Trump is in violation of the Emoluments Clause.

In the ruling, the appeals court held that Trump’s interest in his D.C. hotel – which continues to be patronized by foreign officials – does not in itself prove that the profits necessarily affect him.

“Even if government officials were patronizing the Hotel to curry the President’s favor, there is no reason to conclude that they would cease doing so were the President enjoined from receiving income from the Hotel,” the opinion reads, before going on to call “the link between” Trump’s profits from the hotel and foreign official’s attendance of it “simply too attenuated.”

The panel made sure not to exclude any possibility in its ruling.

After all, as the court wrote, “there is a distinct possibility” that “certain government officials might avoid patronizing the Hotel because of the President’s association with it.” It’s for that reason – which the court noted was “ignored” by both the district court and the attorneys general – that no reasonable spectator could possibly draw a firm link between who pays Trump businesses and the profits the President derives from them.

The appeals court threw out other arguments that the state attorneys general had brought to claim that that they had standing to sue. Those included a claim that Trump’s alleged receipt of emoluments redefined “the terms on which [Maryland] agreed to join the Union.”

The appeals court ruled that Maryland and DC failed to state how they were harmed, or might be remedied.

“When plaintiffs before a court are unable to specify the relief they seek, one must wonder why they came to the court for relief in the first place,” the opinion reads.

The lawsuit brought by the state attorneys general was one of several emoluments cases that accuse Trump of benefitting from foreign government business in violation of a constitutional prohibition on the receipt of things of value from foreign states.

A separate case – brought by Democratic members of Congress – appears to be going through a similar process as the state attorneys general case. On Monday, Trump filed a petition for writ of mandamus in that case in the DC Circuit, in another bid to halt discovery commenced by a district court.

Read the opinion here: