WASHINGTON — A federal judge on Monday found that the Trump administration hasn’t fully followed his order to unfreeze federal spending and told the White House to release all the money.

U.S. District Court Judge John McConnell ruled that ongoing struggles to get federal money for things like early childhood education, pollution reduction and HIV prevention research violated his Jan. 31 order. He ordered the Trump administration to “immediately take every step necessary” to follow his temporary restraining over halting its plans for a sweeping freeze of federal funding.

The judge said his temporary restraining order also blocks the administration from cutting billions of dollars in grant funding from the National Institutes of Health.

“These pauses in funding violate the plain text of the (temporary restraining order),” he wrote. “The broad categorical and sweeping freeze of federal funds is, as the Court found, likely unconstitutional and has caused and continues to cause irreparable harm to a vast portion of this country.”

The administration has said in court documents that it was making good-faith efforts to comply with the judge’s ruling in a lawsuit filed by nearly two dozen states.

The Justice Department argued, however, his ruling applied to a sweeping spending freeze outlined in a late January memo. That memo has since been rescinded.

The Justice Department argued that McConnell’s ruling didn’t apply to other spending pauses outlined in different memos, including funds that were part of President Joe Biden’s signature climate, health care and tax package. McConnell disagreed.

The Republican administration previously said the sweeping funding pause would bring federal spending in line with the president’s agenda.

Meanwhile, lawyers for the Trump administration argued late Sunday that a court order blocking Elon Musk’s aides from entering the Treasury Department’s payment and data systems impinged on the president’s absolute powers over the executive branch, which they said the courts could not usurp.

The administration’s arguments came in a response to a lawsuit filed Friday night by 19 state attorneys general who won a temporary pause Saturday. The lawsuit said the administration’s policy of allowing appointees and “special government employees” access to these systems, which contain sensitive information such as bank details and Social Security numbers, was unlawful.

The New York Times contributed.