President Donald Trump was dealt a major setback in federal court on Wednesday.

A federal judge allowed a lawsuit to move forward that accuses Trump of violating the Constitution by accepting payments from foreign-government officials through his hotel in Washington, DC.

It's the first time such a lawsuit has cleared this initial legal hurdle.

A federal judge on Wednesday ruled that a pair of attorneys general have legal standing to sue President Donald Trump over claims that he's violating the Constitution, marking the first time such a lawsuit has cleared that legal hurdle.

The suit accuses Trump of violating the emoluments clause of the Constitution by taking payments from foreign-government officials via his hotel in Washington, DC.

The ruling, which is likely to be appealed, was made by US District Judge Peter J. Messitte. If it stands, Maryland's attorney general, Brian Frosh, and DC's attorney general, Karl Racine, may be able to seek Trump Organization documents related to the hotel.

"While the Trump Organization is not a party to the lawsuit, the court's decision today does significantly narrow the scope of the case" to encompass only the DC hotel, the Trump Organization said in a statement to The Washington Post. "The court has yet to rule on several additional arguments, which we believe should result in a complete dismissal."

The attorneys general celebrated the ruling.

"We won the first round! Our case moves forward!" Frosh tweeted.

The emoluments clause bars public officials from receiving gifts or cash from foreign governments.

Ethics experts and lawmakers have repeatedly raised concerns about foreign officials' patronage of Trump's properties. Trump, who passed along his business to his two adult sons and a top Trump Organization executive, maintains ties to the business. He did not fully divest himself of it as experts had hoped.

Trump has pledged to donate his hotels' profits from foreign officials to the Treasury. The Trump Organization last month said it had done so.

The attorneys general argue that Trump's refusal to cut ties with his businesses has led to foreign officials paying him through his company, and that Maryland and DC have lost out on business opportunities as a result of these officials instead choosing to spend money at Trump properties.

A similar lawsuit was tossed out last year by a federal judge who questioned whether action from Congress, rather than the judiciary, could better settle the emoluments issue.

But Messitte had a different interpretation, writing, "In absence of congressional approval, this court holds that it may review the actions of the president to determine if they comply with the law."

Last week, Trump was issued a summons in the case, which was expanded to include his capacity as a businessman. His lawyers had three weeks to respond.