(CN) – A federal judge ruled Friday that the Trump administration must fully restore the Deferred Action for Childhood Arrivals program, also known as DACA, after failing to provide justification for ending the program.

In his 25-page opinion, U.S. District Judge John Bates said he will delay the implementation of his ruling to afford the Trump administration 20 days “to determine whether it intends to appeal the Court’s decision and, if so, to seek a stay pending appeal.”

Bates concluded the administration’s September 2017 decision to rescind the DACA program “was both subject

to judicial review and arbitrary and capricious.

“The Court has already once given DHS the opportunity to remedy these deficiencies — either by providing a coherent explanation of its legal opinion or by reissuing its decision for bona fide policy reasons that would preclude judicial review — so it will not do so again. Consequently, the government’s motion to reconsider the

Court’s April 24, 2018 order will be denied,” he wrote.

In April Bates gave DHS 90 days to “better explain its view that DACA is unlawful.” If the department cannot come up with a better explanation, he wrote, it “must accept and process new as well as renewal DACA applications.”

Bates stressed that the court does not believe the administration, through the Department of Homeland Security, lacks the statutory or constitutional authority to rescind the DACA program.

Instead, he said, if the administration wants to end the program, it must put forward “a rational explanation for its decision.”

“A conclusory assertion that a prior policy is illegal, accompanied by a hodgepodge of illogical or post hoc policy assertions, simply will not do,” Bates wrote.

UPDATE: Attorney General Jeff Sessions waited until Monday to speak out about the ruling.

“We strongly disagree with the district court’s decision on Friday in the Deferred Action for Childhood Arrivals (DACA) case,” Sessions said. “The executive branch’s authority to simply rescind a policy, established only by a letter from the secretary of the Department of Homeland Security, is clearly established. The Department of Justice will take every lawful measure to vindicate the Department of Homeland Security’s lawful rescission of DACA.”

Lashing out against the Obama Administration, Sessions said DACA was on the same legal path that led to the invalidation of the Deferred Action for Parents of Americans and Lawful Permanent Residents (DAPA).

“Not only did the Trump Administration have the authority to withdraw this guidance letter, it had a duty to do so,” Sessions said. “As former President Obama previously said, the changes they attempted to effect through this policy letter can only be lawfully achieved by congressional action. The judicial branch has no power to eviscerate the lawful directives of Congress — nor to enjoin the executive branch from enforcing such mandates.”

Sessions also tied Friday’s ruling in the DACA case to the stack of defeats that courts across the country have dealt to Trump since he took office.

“We have recently witnessed a number of decisions in which courts have improperly used judicial power to steer, enjoin, modify, and direct executive policy,” Sessions said. “This ignores the wisdom of our Founders and transfers policy making questions from the constitutionally empowered and politically accountable branches to the judicial branch. It also improperly undermines this administration’s ability to protect our nation, its borders, and its citizens. The Trump administration and this Department of Justice will continue to aggressively defend the executive branch’s lawful authority and duty to ensure a lawful system of immigration for our country.”