A New York federal judge barred the Justice Department on Tuesday from changing its lawyers in a legal fight over the Trump administration's effort to add a citizenship question to the 2020 census.

U.S. District Court Judge Jesse Furman, an Obama appointee, said government lawyers' motion for the change was "patently deficient" except in the case of two lawyers who have already left the department or the civil division which is handling the case.

"Defendants provide no reasons, let alone 'satisfactory reasons,' for the substitution of counsel," Furman wrote.

TOP DEMOCRAT ON HOUSE APPROPRIATIONS PANELS WILL FIGHT TO OPPOSE TRUMP CITIZENSHIP QUESTION ON CENSUS

The Justice Department sought to switch out its legal team Monday after some of its attorneys seemed to be giving up on the legal fight. Attorney General Bill Barr told the Associated Press that he had learned from a top DOJ civil attorney leading the litigation effort that multiple people on the team preferred not to continue.

Trump reacted to the ruling hours after it was issued.

"So now the Obama appointed judge on the Census case (Are you a Citizen of the United States?) won’t let the Justice Department use the lawyers that it wants to use. Could this be a first?" he tweeted.

The American Civil Liberties Union praised Furman's ruling in a Tuesday statement.

TRUMP SLAMS 'FAKE' REPORTS THAT CITIZENSHIP QUESTION FIGHT IS OVER

“The Justice Department owes the public and the courts an explanation for its unprecedented substitution of the entire legal team that has been working on this case," said Dale Ho, ACLU voting rights project director. "The Trump administration is acting like it has something to hide, and we won’t rest until we know the truth.”

Trump has vowed to continue his effort to include the question, even after the U.S. Supreme Court last month temporarily blocked him from introducing it. The president has indicated he would use his executive order power to add the question to the census.

Furman also questioned how the Justice Department would meet deadlines in the case if a batch of new attorneys came on board, noting that government lawyers have three days to submit written arguments in the case.

"As this court observed many months ago, this case has been litigated on the premise — based 'in no small part' on Defendants’ own 'insist[ence]' — that the speedy resolution of Plaintiffs’ claims is a matter of great private and public importance," he wrote. "If anything, that urgency — and the need for efficient judicial proceedings — has only grown since that time."

The judge ordered that any DOJ lawyer who wished to withdraw from the case submit a signed sworn affidavit with a sufficient reason.

On Tuesday, the president blasted the Supreme Court on Twitter over the citizenship question decision and its 2012 ruling that held the Patient Protection and Affordable Care Act -- which he has tried to repeal -- in place.

"I have long heard that the appointment of Supreme Court Justices is a President's most important decision. SO TRUE!" he posted.

CLICK HERE TO GET THE FOX NEWS APP

The Justice Department did not immediately respond to a Fox News request for comment.