Republican Presidential Candidate Donald Trump speaks during the opening ceremony for the Trump International Hotel, Old Post Office, in Washington, USA on October 26, 2016.

A federal appeals court on Wednesday dismissed a lawsuit challenging the legality of payments to President Donald Trump's hotels by foreigners during his tenure in the White House.

A three-judge panel of the U.S. Circuit Court of Appeals for the 4th Circuit unanimously ruled that the state of Maryland and the District of Columbia do not have legal standing to sue under a claim that Trump violated the so-called emoluments clause of the U.S. Constitution.

That clause, contained in Article 1 of the Constitution, bars government officeholders from accepting gifts from foreign officials.

Trump still faces a similar lawsuit in Washington federal court filed by Democratic members of Congress.

On Monday, the Justice Department urged the D.C. Circuit Court of Appeals to dismiss that second suit.

In its ruling, the 4th Circuit appeals panel said that Washington and Maryland's interest in enforcing that clause "is so attenuated and abstract" that it raises the question of whether their lawsuit is an appropriate use of the court system.

The suit was the first ever to claim a president violated the emoluments clause, and the appeals panel said "not only is this suit extraordinary, it also has national significance and is of special consequence."

The panel ordered a federal district court judge in Maryland to dismiss the suit against Trump with prejudice, which would bar the plaintiffs from relaunching the case.

That judge had earlier denied Trump's bids to toss out the case, which led the president to appeal his decision to the 4th Circuit.

Trump quickly crowed about the 4th Circuit's decision on Twitter.

Tweet

The president's lawyer, Jay Sekulow, called the ruling "a complete victory."

The attorneys general for Washington and Maryland issued a joint statement saying they believed the appellate judges "got it wrong."

"Although the court described a litany of ways in which this case is unique, it failed to acknowledge the most extraordinary circumstance of all: President Trump is brazenly profiting from the Office of the President in ways that no other President in history ever imagined and that the founders expressly sought—in the Constitution—to prohibit," said Maryland Attorney General Brian Frosh and District of Columbia Attorney General Karl Racine.

The two said they will "pursue our legal options," but did not name specific next steps.

They can ask the entire 4th Circuit to review the panel's ruling, or can escalate the matter to the Supreme Court, which has discretion over which cases it hears.

There is a good chance that they will ask the full court to review the decision, according to Carl Tobias, a professor of law at the University of Richmond Law School and an expert on federal judicial selection.

"I think a majority of the court is more moderate, or even liberal, compared to this panel, which is the most conservative panel you could draw of those 15 judges on this court," Tobias said. "I guess we will see something different out of the D.C. Circuit, but who knows."

The judges on the 4th Circuit panel that heard the case were Paul Niemeyer, who was appointed by President George H.W. Bush, Dennis Shedd, who was appointed by President George W. Bush, and Trump appointee A. Marvin Quattlebaum Jr.