A federal appeals court Wednesday threw out a lawsuit challenging President Donald Trump's ownership of a luxury hotel five blocks from the White House. It was a defeat for Maryland and the District of Columbia, who claimed that his vast holdings presented a conflict between his business profits and the nation's interest.

Wednesday's ruling said the lawsuit failed to make a clear showing that Trump's ownership of the hotel was creating competition with local convention centers. And the court said the local governments couldn't show how any such competition, if it existed, could be legally prevented.

The case was so weak that "it readily provokes the question of whether this action against the President is an appropriate use of the courts," said a unanimous three-judge panel of the Fourth Circuit Court of Appeals, based in Virginia.

The attorneys general of Maryland and Washington, DC accused President Trump of violating the Constitution's emolument's clauses, which bar the president from receiving "any present, emolument, office or title of any kind whatever from any king, prince, or foreign state" or any state in the U.S. Their lawsuit, filed in 2017, said he improperly benefits financially whenever foreign or state governments patronize the Trump International Hotel on Pennsylvania Avenue.

But the appeals court said Maryland and the District could not prove that state or foreign governments were patronizing the Trump hotel because it distributes profits or dividends to the president, rather than because of any of the hotel's other characteristics.

"Even if government officials were patronizing the hotel to curry the president's favor," the court said, "there is no reason to conclude that they would cease doing so were the president enjoined from receiving income from the hotel. After all, the hotel would still be publicly associated with the president, would still bear his name, and would still financially benefit members of his family."

In short, the court concluded, the link between official patronage of the hotel and the hotel's payments of profits to Trump is too remote to justify the lawsuit. And the ruling said it was not at all clear that any court action barring the president from receiving money from the hotel would cause officials to stop patronizing it.

Maryland and D.C. had argued that the hotel was unfairly competing with D.C.'s convention center and Maryland's National Harbor development, both of which earn local tax revenue and help area businesses.

The ruling was the third defeat for claims against President Trump based on the Constitution's emolument clauses. But another lawsuit, filed by members of Congress, has been allowed to proceed to the evidence-gathering stage. It claims that the president's acceptance of foreign emoluments without congressional approval violates the Constitution.

In a joint statement, Maryland Attorney General Brian Frosh and Washington, DC Attorney General Karl Racine said they will appeal.

“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. We will continue to pursue our legal options to hold him accountable.”

Trump celebrated the decision on Twitter Wednesday afternoon.

"Word just out that I won a big part of the Deep State and Democrat induced Witch Hunt," Trump tweeted. "Unanimous decision in my favor from The United States Court of Appeals For The Fourth Circuit on the ridiculous Emoluments Case. I don't make money, but lose a fortune for the honor of serving and doing a great job as your President (including accepting Zero salary!)."

In 2018, the Trump International Hotel generated a revenue of more than $40.8 million, up from $40.4 million in 2017, according to the president's annual financial disclosure forms.

The disclosure reports show revenue, not profits, and some of the figures are given in ranges, giving only a partial picture of his finances.

"Today’s pair of decisions by the 4th Circuit Court of Appeals is a complete victory," Trump's personal attorney, Jay Sekulow, said in a statement. "The decision states that there was no legal standing to bring this lawsuit in the first place. This latest effort at Presidential harassment has been dismissed with prejudice."