​A federal appeals court gave President Trump a huge win on Wednesday when it tossed a lawsuit that claimed he was violating the Constitution by profiting from foreign government officials staying at his DC hotel.

The lawsuit was brought by the attorneys general of Maryland and the District of Columbia, who said Trump was in violation of the emoluments clause that restricts members of the US government from receiving gifts from foreign and domestic entities.

Trump celebrated the unanimous ruling by the Fourth Circuit Court of Appeals on Twitter.

“Word just out that I won a big part of the Deep State and Democrat induced Witch Hunt. Unanimous decision in my favor from The United States Court of Appeals For The Fourth Circuit on the ridiculous Emoluments Case​,” he wrote. “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!).​”​

The court said the attorneys general lacked standing to bring the suit in the ruling that puts an end to the subpoenas seeking Trump’s financial information.

​”​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, which were created to resolve real cases and controversies between the parties,​”​ ​Judge Paul Niemeyer, one of the three on the panel, ​wrote in the opinion.​

​”​This latest effort at Presidential harassment has been dismissed with prejudice​,” he said.​

​The lawsuit, filed two years ago, alleged foreign government officials were staying at Trump’s DC hotel to benefit and influence the president.