U.S. President Donald Trump speaks to the media on the South Lawn of the White House in Washington, U.S., before his departure to Alabama and New York, November 9, 2019. REUTERS/Yuri Gripas

(Reuters) - A federal judge on Monday dismissed New York’s attorney general and state tax commissioner as defendants in U.S. President Donald Trump’s lawsuit seeking to block a House of Representatives committee from obtaining his New York state tax returns.

U.S. District Judge Carl Nichols in Washington, D.C. said he lacked jurisdiction over Letitia James, the attorney general, and Michael Schmidt, commissioner of the state’s Department of Taxation and Finance. The dismissal was without prejudice.

Nichols said Trump could sue the New York officials in that state.

The ruling may not end the lawsuit before Nichols. Trump also sued the U.S. House Ways and Means Committee, and the judge ordered congressional lawyers and the president’s attorneys to confer and file a joint status report outlining how they would propose to proceed.

New York passed a law earlier this year that would allow the congressional committee to access Trump’s state tax returns.

Trump’s lawyers filed a lawsuit in July, arguing that the New York law violates his free speech rights.

New York’s law “was enacted to retaliate against the President because of his policy positions, his political beliefs, and his protected speech, including the positions he took during the 2016 campaign,” Trump’s lawyers said in a court filing.

The lawsuit is just one of several court fights over access to Trump’s tax returns.

Last week, an appeals court in New York ruled that Trump’s longtime accounting firm must hand over eight years of his tax returns to New York prosecutors. Trump’s lawyers have said they will take that case to the U.S. Supreme Court.