A US judge has ordered the Trump administration to fully reinstate the Deferred Action for Childhood Arrivals (DACA) programme, potentially opening the door for more young, undocumented immigrants to apply for legal protections as early as the end of this month.

Upholding his April order requiring the reinstatement of the Obama-era programme, which President Donald Trump attempted to end late last year, US District Judge John Bates had earlier given the current administration 90 days to "to better explain its view that DACA is unlawful”.

He has now ruled that they failed to do so.

A memo from Homeland Security Secretary Kirstjen Nielsen in June offered "nothing even remotely approaching a considered legal assessment that this court could subject to judicial review", he wrote.

He added: “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."

The judge based in Washington DC gave the government 20 days to appeal his ruling before it must start accepting new applications for the programme.

He is the third judge to slow the administration’s attempts to rescind DACA – a programme that gives certain legal rights to undocumented immigrants who arrived in the US as children.

US rescinds DACA program for young immigrants

Previous rulings in California and New York required the government to honour protections for the more than 700,000 existing recipients. The administration has appealed these rulings.

The administration signalled it may appeal Judge Bates' ruling as well, reiterating its position that the DACA programme is an “unlawful circumvention of Congress,” which the Department of Homeland Security has the power to rescind.

"The Justice Department will continue to vigorously defend this position, and looks forward to vindicating its position in further litigation,” Justice Department spokesperson Devin O'Malley said in a statement.

‘Families belong together’ protests over Trump immigration policy Show all 8 1 /8 ‘Families belong together’ protests over Trump immigration policy ‘Families belong together’ protests over Trump immigration policy Mishawaka, Indiana AP ‘Families belong together’ protests over Trump immigration policy Washington DC AFP/Getty Images ‘Families belong together’ protests over Trump immigration policy New York Mayor Bill De Blasio speaks in Tornillo, Texas alongside the many other US mayors who have called for detained immigrant children to be reunited with their families AP ‘Families belong together’ protests over Trump immigration policy Albuquerque Mayor Tim Kelle leaves a teddy bear as a gift for detained immigrant children in Tornillo, Texas AP ‘Families belong together’ protests over Trump immigration policy Seattle Mayor Jenny Durkan and Los Angeles Mayor Eric Garcetti leave sandals as gifts for detained immigrant children in Tornillo, Texas AP ‘Families belong together’ protests over Trump immigration policy San Diego, California EPA ‘Families belong together’ protests over Trump immigration policy US embassy, Mexico City AFP/Getty Images ‘Families belong together’ protests over Trump immigration policy San Diego, California EPA

The ruling may also conflict with an upcoming ruling in Texas, where the state and six other plaintiffs have sued to end the programme. If the suit is successful, it may put a hold on new applications.

United We Dream, an organisation that represents the young, undocumented immigrants often called “Dreamers,” was hesitant to celebrate the decision.