A federal judge ordered the Trump administration to fully reinstate Deferred Action for Childhood Arrivals, or DACA, the Obama-era program that provides deportation protection for more than 700,000 immigrants who were brought to the United States as children.

In addition to full restoration of the program, U.S. District Judge John Bates late Friday (August 3) ruled that the federal government must also accept new applications for the program, which allows immigrants to work and study without fear of deportation. Bates stayed his order until August 23, giving the administration time to decide if it will appeal the decision.

In April, Bates, a George W. Bush appointee, ordered the Trump administration to restore DACA, ruling that its rescission was “arbitrary and capricious.” But he stayed his decision for 90 days to give the government time to justify the termination.

In that span, Kirstjen Nielsen, secretary of the Department of Homeland Security (DHS), argued that the decision to rescind DACA was legally sound because “the DACA policy was contrary to law” and “because there are, at a minimum, serious doubts about its legality.”

Former President Obama created DACA in 2012 via an executive order. The order prevented the deportation of immigrants who arrived in the United States under the age of 16, continuously resided in the country for at least five years, were in school or graduated, had no felony or serious misdemeanor record, and were age 30 or younger at the time of application.

In his latest ruling, Bates wrote:

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.

On Friday, the Department of Justice (DOJ) vowed to continue defending its position.

“Today’s order doesn’t change the Department of Justice’s position on the facts: DACA was implemented unilaterally after Congress declined to extend benefits to this same group of illegal aliens. As such, it was an unlawful circumvention of Congress, and was susceptible to the same legal challenges that effectively ended DAPA [Deferred Action for Parents of Americans],” the DOJ told press.

In September, Attorney General Jeff Sessions announced that the Trump administration would rescind DACA, calling on Congress to find a legislative solution for the program’s recipients—something it has continuously failed to do.

But the decision to end DACA has faced several legal challenges. In January, a U.S. district judge ruled that the program must remain in place while legal challenges against its termination wind through the courts. It’s a decision that was echoed by another federal judge in February.

In May, a coalition of seven Republican states sued the Trump administration in an effort end DACA. A district judge in Texas is expected to hear the state’s request to halt DACA this week.