Washington (CNN) A federal judge on Friday hinted he will likely invalidate the Deferred Action for Childhood Arrivals program in the future -- but for now the program can continue to operate.

The ruling was an unexpected, albeit temporary, reprieve for the program, which President Donald Trump opted to end almost exactly a year ago.

Texas-based District Judge Andrew Hanen wrote Friday that he believes DACA is likely illegal and ultimately will fail to survive a challenge before his court. DACA is an Obama-era program that protects young undocumented immigrants who came to the US as children from deportation.

But despite that -- and despite finding that the continuation of DACA could harm the eight states and two governors who challenged the program -- Hanen decided not to issue a ruling that would have immediately blocked DACA's continuation.

Since Trump sought to end DACA last September, the program's future has been in doubt. Members of Congress largely say they want to preserve the program legislatively, but have failed to pass anything in two opportunities to do so. In the meantime, three federal courts have sustained the program.

While Hanen rebuffed the red states' request to end DACA immediately, his inclination to invalidate the program eventually contributes to what experts expect to be a fast track to the Supreme Court in the coming year.

Hanen said that there were two issues that required him to deny the request to immediately halt the program: One was timeliness. He found that because Texas and its coalition of states waited more than five years after the implementation of DACA, even as it challenged a related program, to file this suit, that it lost some of its ability to claim damages were immediately harmful and thus required an immediate response.

In addition, Hanen ruled that though the states could prove they were harmed by the continuation of DACA, mainly in costs of benefits to recipients, the potential consequences of ending DACA immediately were more harmful.

Three federal judges have blocked the administration from ending DACA as it tried to do last September, ordering the Department of Homeland Security to continue renewing permits under the program.

But Hanen was widely expected to be unfavorable to DACA, as he had previously prevented a similar, expanded program from ever going into effect under the Obama administration.

The new case challenging the DACA program, instituted in 2012, drew heavily from that decision Hanen made on the 2014 expansion of the program and creation of a similar program for undocumented parents of Americans.

Hanen said in his Friday ruling that he largely agreed, and DACA was likely to be illegal under the same reasoning as that expansion.

But one major difference prevented him from immediately halting the program -- the fact that it was already in effect.

"Here, the egg has been scrambled," Hanen wrote. "To try to put it back in the shell with only a preliminary injunction record, and perhaps at great risk to many, does not make sense nor serve the best interests of this country."

But in his 117-page decision, Hanen was clear that he did not intend his ruling to be interpreted as good news for the future of DACA, at least long term.

He said the popularity of the program was not relevant to whether it had been legally created -- the crux of the challenge to it.

"DACA is a popular program and one that Conress should consider saving," Hanen wrote. Nevertheless, "this court will not succumb to the temptation to set aside legal principles and to substitute its judgment in lieu of legislative action. If the nation truly wants to have a DACA program, it is up to Congress to say so."

Texas Attorney General Ken Paxton, who led the challenge to DACA, hailed the ruling in a statement, despite it being an interim loss in court.

"We're now very confident that DACA will soon meet the same fate as the Obama-era Deferred Action for Parents of Americans program, which the courts blocked after I led another state coalition challenging its constitutionality," Paxton said. "Our lawsuit is vital to restoring the rule of law to our nation's immigration system."

Hanen's ruling Friday defuses the threat to DACA for some time. In a separate order, Hanen took the unusual step of making it possible to appeal his denial of an immediate halt to the program, and gave the parties three weeks to figure out next steps before the case moves to its next phase.

The Department of Justice declined to defend DACA in the lawsuit, but did ask Hanen to limit the effect of any ruling he may have issued.

Spokesman Devin O'Malley said in a statement that Hanen had agreed DACA is unlawful, "as the Justice Department has consistently argued," and said the department was "pleased" with the decision.

In the administration's stead, DACA was defended by the pro-immigrant advocacy and legal organization MALDEF and the state of New Jersey.

In a statement Friday, MALDEF hailed the ruling but noted it still believes DACA to be legal.

"While MALDEF continues to disagree adamantly with the judge's views on the legality of DACA under the Administrative Procedures Act (APA), and on whether the state of Texas even has standing -- as required by the Constitution -- to challenge DACA, today's court decision appropriately leaves DACA in place with respect to over 100,000 Texans and hundreds of thousands of others nationwide," said Thomas A. Saenz, president and general counsel of MALDEF.

This story has been updated.