WASHINGTON — A federal judge ruled Wednesday that Maryland and the District of Columbia can proceed with their lawsuit accusing President Donald Trump of unconstitutionally accepting payments from foreign and state interests through his Washington hotel. The decision clears the way for the plaintiffs to seek financial records and other materials from the president’s company.

In his ruling, U.S. District Judge Peter J. Messitte, based in Maryland, rejected arguments from the Justice Department that earnings from business activities, including hotel room stays, do not qualify as unconstitutional gifts. At issue is the Constitution’s emoluments clause, which bans federal officials from accepting benefits from foreign or state governments without congressional approval. The plaintiffs argue Trump’s hotel harms area businesses because of the president’s ties.

Messitte’s ruling was the first time that a federal judge has interpreted the emoluments clause, which had never been fully tested in an American courtroom. Two other lawsuits based on the emoluments clause are also being heard in other federal courts.

In his 52-page opinion, the judge said attorneys general for Maryland and the District had “convincingly argued” that the Constitution treats emoluments “as any ‘profit,’ ‘gain,’ or ‘advantage.'”

“The Court finds the President is subject to both Emoluments Clauses of the Constitution and that the term ’emolument’ in both clauses extends to any profit, gain or advantage,” Messitte wrote.

The judge ordered both sides to provide a schedule of their next steps within 21 days, including how to handle legal discovery of records sought by Maryland and the District.

A spokesman for the Justice Department, Andy Reuss, said the administration continues “to maintain that this case should be dismissed.” Reuss added that the department “is reviewing the order and determining next steps to continue vigorously defending the President.” They could appeal Messitte’s ruling to a federal appeals court.

Declaring Messitte’s ruling a “series of common sense conclusions,” Maryland Attorney General Brian Frosh said Wednesday that he expected both jurisdictions to press for a wide range of financial documents and related materials from the Trump Organization and the Trump International Hotel.

Among the documents likely sought by the plaintiffs, Frosh said, would be several years of the president’s income taxes. The tax returns would be necessary to pinpoint any payments from foreign and state interests to the hotel, Frosh said.

Frosh, a Democrat, added that the plaintiffs might ask for tax records dating several years earlier than the hotel’s September 2016 opening to learn more about the hotel’s financing. The attorneys general have already put the hotel and the company on notice to preserve a wide range of records.

“I think it’s clear we’re entitled to financial information that underpins our case,” Frosh said.

Frosh acknowledged that both the company and the hotel would likely object to any subpoenas for records, which could delay the case. And any appeal could freeze any legal discovery, depending on how a federal appellate court rules.

District Attorney General Karl Racine, a Democrat, said the judge’s interpretation of the emoluments clause shows that “the president can’t accept money or other benefits from foreign or domestic governments.”

Norman Eisen, a former Obama administration ethics counsel, said the ruling represented a “major leap forward” in learning “how Trump is profiting off the presidency.”

“It is another major crack in the dam that has so far been holding back accountability,” said Eisen, who chairs Citizens for Responsibility and Ethics in Washington, a good-government group that has joined the two jurisdictions in the lawsuit.

The Maryland case is one of three lawsuits against Trump based on the emoluments clause that are winding through the federal courts. A New York federal judge turned down another lawsuit from Citizens for Responsibility and Ethics in Washington, but the case is now on appeal. And a case brought by nearly 200 Democratic Party congressional officials is also being heard by a federal judge in Washington, D.C.