A federal judge in Brooklyn on Thursday urged the Trump administration to extend its deadline for young undocumented immigrants to apply to stay in the United States under an Obama-era program that the White House recently promised to end.

Last week, Attorney General Jeff Sessions announced that immigrants shielded from deportation by the program, which is known as the Deferred Action for Childhood Arrivals or DACA, would have until Oct. 5 to reapply for protected status. But the federal judge, Nicholas G. Garaufis, said the deadline was too soon and requested it be pushed back so that the president and Congress have time to fix the program through legislation.

“The concern of the court is that Oct. 5 is three weeks away,” Judge Garaufis said at an hourlong hearing in Federal District Court in Brooklyn. “It would make a lot of sense from various vantage points to extend this deadline.”

DACA has protected hundreds of thousands of children and young adults who were brought illegally to the United States by their parents. And the only ones who would be “harmed” by keeping the deadline in place, Judge Garaufis said, were the young immigrants themselves — or as he put it: “The 800,000 people who are sweating that someone will knock on their doors and send them to a country they don’t even know.”