U.S. President Donald Trump on Wednesday scored a crucial victory in a Democratic-backed lawsuit that accuses him of violating anti-corruption provisions of the U.S. Constitution with his Washington hotel.

The Richmond, Virginia-based 4th U.S. Circuit Court of Appeals issued a set of decisions instructing a lower court judge to dismiss the lawsuit filed against the Republican president in June 2017 by the Democratic attorneys general of Maryland and the District of Columbia.

The court said the attorneys general lacked legal standing to bring the case.

The court said the District of Columbia 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.”

A spokesperson for D.C. Attorney General Karl Racine did not immediately respond to a request for comment.

“Today’s pair of decisions by the 4th Circuit Court of Appeals is a complete victory,” Jay Sekulow, a lawyer for Trump, said in a statement. “This latest effort at presidential harassment has been dismissed with prejudice.”

The president reacted quickly to the ruling on what he called a “ridiculous” case, stating on Twitter: “I don’t make money, but lose a fortune for the honour of serving and doing a great job as your president.”

Democrats still pursuing probes

Trump opened the Trump International Hotel, just blocks from the White House, shortly before he was elected in November 2016. Unlike past presidents, he has retained ownership of numerous business interests, including the hotel, while serving as president.

Since his election, the hotel has become a favoured lodging and event space for some foreign and state officials visiting the U.S. capital. A public relations firm working for Saudi Arabia spent nearly $270,000 US on food and rooms, while the Philippine and Kuwaiti embassies have also had parties there.

The lawsuit alleges that, in failing to disengage from the hotel, Trump has made himself vulnerable to inducements by foreign governments seeking to curry favour, violating the emoluments clause of the Constitution.

Maryland-based U.S. District Judge Peter Messitte last year allowed the lawsuit to proceed — a ruling that Trump appealed to the 4th Circuit.

All three judges on the panel were nominated by Republican presidents: Paul Niemeyer, by George H.W. Bush; Dennis Shedd, by George W. Bush, and Judge A. Marvin Quattlebaum, by Trump.

A similar case brought by nearly 200 congressional Democrats in the District of Columbia’s federal court also deals with the idea that Trump is using the presidency for his personal profit, but that case is uniquely different in that the Congress is specifically mentioned in the emoluments clause itself. On Monday, the Justice Department petitioned for a writ of mandamus in the D.C. appeals court and asked for a stay on the 37 subpoenas issued in that case.

Democrats in Congress have signalled their intent to pursue investigations on whether Trump is profiting from both his domestic and foreign hotels and entities while serving in office.

“The president’s loyalty to the United States must be complete and undivided,” Democratic congressman Jerry Nadler said in a statement earlier this week.

“The American people deserve to know whether their president is selling them out for his own personal benefit,” added Nadler, the chair of the House’s judiciary committee.