WASHINGTON -- A federal judge ruled Friday that the Trump administration still did not adequately justify its reasoning behind ending the DACA program for young illegal immigrants.

The judge gave the Department of Homeland Security 20 days to decide whether it would appeal the decision. If it doesn't, the Deferred Action for Childhood Arrivals program must be reinstated, the judge said.

In April, U.S. District Judge John D. Bates overruled the Trump administration's plan to end the DACA program for immigrants brought the United States illegally as children. 

But the court was given 90 days to better explain the reasons behind ending the program.

The court says its ruling doesn't mean the DHS lacks the authority to rescind DACA. The court says that if DHS wishes to end the program, it must give a rational explanation.

"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 said in his ruling.

The DACA program offers renewable two-year grants to certain young people that guarantee they will not be removed from the country, and be allowed to live and work as long as they followed certain requirements.

In September 2017, the Trump administration rescinded the DACA program, calling it a litigation risk.

But in April, the court ruled that DHS's legal judgment on DACA was subject to a court review and was "aribitrary and capricious because (a) DHS's legal judgment was inadequately explained... and (b) the other reasons offered for DACA's rescission -- mainly, the purported "litigation risk" that DACA would preliminarily enjoined by the district court in Texas -- were insufficiently reasoned."

In June, the ruling said Homeland Security Secretary Kirstjen Nielsen issued a memorandum, but instead of issuing a new decision that better explained the DACA decision, Bates said Nielsen decided not to explain why the original reason to rescind the DACA policy remained sound.