President Trump scored a big win on Wednesday when the Fourth Circuit Court of Appeals agreed to throw out a case that accused him of violating the Constitution through earnings from D.C. businesses including the Trump International Hotel.

The lawsuit, brought by the attorneys general of Maryland and Washington, D.C., claimed that earnings from the hotel and its related businesses violated prohibitions against receiving benefits from foreign governments, the U.S., or individual states. The Fourth Circuit declared that Maryland and D.C. lacked standing to bring the case in the first place, and ordered the lower court to dismiss the complaint.

DOJ FILES TO HALT TRUMP SUIT DEMANDING FINANCIAL DOCUMENTS

“Word just out that I won a big part of the Deep State and Democrat induced Witch Hunt,” Trump tweeted Wednesday morning. “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!).”

The complaint claimed that by maintaining ownership of his businesses, Trump earned “millions of dollars in payments, benefits, and other valuable consideration from foreign governments and persons acting on their behalf, as well as federal agencies and state governments.” The Foreign Emoluments Clause of the Constitution prohibits people holding office from accepting “any present, emolument, office, or title, of any kind whatever, from any king, prince, or foreign state” without congressional consent.

Similarly, the Domestic Emoluments Clause says that the president “shall not receive … any other Emolument from the United States, or any of them” other than a salary.

The Fourth Circuit ruled that D.C. and Maryland could not properly bring such a case against Trump because they did not establish that they suffered any harm that justified the lawsuit. They claimed that their interest was in protecting local businesses that allegedly lost out on business because officials would patronize Trump’s establishments instead. They also claimed that the Trump International Hotel has an “unlawful competitive advantage” over D.C. properties and that Maryland loses out on tax revenue because business is going to Trump’s D.C. businesses instead.

The Fourth Circuit did not buy these arguments.

“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,” the court’s opinion said, noting that the “alleged harm amounts to little more than a general interest in having the law followed,” which is not enough to constitute an actual case or controversy to be heard by the courts.

CUOMO SIGNS BILL ALLOWING CONGRESS TO GET TRUMP TAX RETURNS

“We are pleased that the Fourth Circuit unanimously decided to dismiss this extraordinarily flawed case,” Justice Department spokesperson Kelly Laco said in a statement. “The court correctly determined that the plaintiffs improperly asked the courts to exceed their constitutional role by reviewing the President’s compliance with the Emoluments Clauses.”

Trump’s personal attorney Jay Sekulow celebrated the outcome as “a complete victory.”

“The decision states that there was no legal standing to bring this lawsuit in the first place,” Sekulow said in a statement. “This latest effort at Presidential harassment has been dismissed with.”

D.C. Attorney General Karl Racine and Maryland Attorney General Brian Frosh said in a joint statement that they “will continue to pursue our legal options,” and that they believe the Fourth Circuit 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,” the statement said. “We have not and will not abandon our efforts to hold President Trump accountable for violating the Nation’s original anti-corruption laws.”

According to Bloomberg, the profits the Trump Organization as a whole earned from foreign countries and officials over the past year amounted to  $191,538, an increase of 26 percent from the year before. The Organization, the operation of which Trump left to his children when he took office, donated that same amount to the U.S. Treasury to avoid Emoluments Clause concerns.

On Monday, the Justice Department filed a challenge in a separate Emoluments Clause case with the D.C. Court of Appeals. That case, brought by congressional Democrats, involved Trump properties including hotels in New York and D.C., as well as Mar-a-Lago in Florida. The DOJ’s filing seeks the dismissal of the case, or at least a halt to the discovery process that would involve turning over various business records.

Fox News’ Bill Mears and The Associated Press contributed to this report.