A federal judge dismissed President Trump's lawsuit that attempted to block a newly passed law that would allow Congress to obtain his New York state tax returns — but allowed for Trump to try again in the future.

The law, known as the TRUST Act, was signed by Gov. Andrew Cuomo in July and calls for the commissioner of the New York State Department of Taxation and Finance to release the president's tax returns if requested by the chair of the House Ways and Means Committee, Senate Finance Committee, or the Joint Committee on Taxation.

So far, no such request has been made, and District Court Judge Carl Nichols – a Trump appointee – ruled that the D.C. federal court did not have jurisdiction over the New York tax commissioner or the state Attorney General.

TRUMP ATTORNEY VOWS TO GO TO SUPREME COURT IN TAX RETURN CASE AFTER APPEALS COURT ALLOWS SUBPOENA

"Mr. Trump bears the burden of establishing personal jurisdiction, but his allegations do not establish that the District of Columbia’s long-arm statute is satisfied here with respect to either Defendant," Nichols wrote in a decision handed down Monday. "Mr. Trump has also not demonstrated that jurisdictional discovery is warranted. Mr. Trump may renew his claims against the New York Defendants should future events trigger one or more provisions of the D.C. long-arm statute, and he may, of course, sue either New York Defendant in another forum (presumably in New York)."

The judge noted that in theory there could be a situation where the D.C. court could have jurisdiction over the New York officials in this matter, such as if the commissioner hand-delivered Trump's tax returns to a congressional committee.

"But speculation that they might occur is insufficient to exercise jurisdiction over the Commissioner now," Nichols wrote. In a footnote, Nichols also cited potential legal complications involved in having a D.C. federal court rule on the constitutionality of a New York state law.

Trump has argued that the law poses a First Amendment issue, claiming that it targets him due to his political beliefs and speech. New York Republicans also opposed the law, claiming that is what is known as a "bill of attainder" – meaning one that singles out an individual for punishment – which is prohibited by the Constitution.

The language of the law does not mention Trump at all, but Democrats like state Sen. Brad Hoylman, who sponsored a version of the bill, and House Judiciary Committee Chairman Rep. Jerrold Nadler, D-N.Y., specifically mentioned Trump in reference to the legislation before it passed. Nadler described it in the context of House Democrats' quest to get Trump's tax returns, calling it "a workaround to a White House that continues to obstruct and stonewall the legitimate oversight work of Congress."

CLICK HERE TO GET THE FOX NEWS APP

The president's attorneys are reviewing the decision, Fox News has learned.

Trump's lawsuit also named the House Ways and Means Committee as a defendant. The case against the committee is still proceeding in federal court.

Fox News' John Roberts contributed to this report.