image copyrightReutersimage captionA protester demonstrating in support of the scheme holds up a placard that reads: "I am an American"
A federal judge in Texas has ruled that a programme protecting migrants who came to the US as children from deportation is illegal.
Judge Andrew Hanen said new applicants should not be enrolled in Deferred Action for Childhood Arrivals (Daca).
But he said the ruling does not require the government to deport any Daca recipients.
Nearly 650,000 people – known as Dreamers – are currently enrolled in the programme.
President Joe Biden has ordered his administration to strengthen the initiative. The US Supreme Court last year blocked a bid by former President Donald Trump to end Daca.
In Friday's ruling, Judge Hanen agreed with a group of states that had filed a lawsuit arguing the programme was illegally created by former President Barack Obama in 2012.
Texas and eight other conservative states said Mr Obama had acted without due congressional authorisation.
media captionDaca recipients: 'Life in the US is like a rollercoaster'
Daca recipients are shielded from deportation, granted work authorisation, can have driving licences and apply for education financial aid.
This is the second time a federal court in Texas has dealt a blow to Mr Biden's immigration agenda.
In January, a judge blocked the Democratic president's attempt to impose a 100-day moratorium on deportations.
Democratic US Senator Bob Menendez of New Jersey tweeted on Friday it was time for Mr Biden's party, which commands narrow majorities on Capitol Hill, to act.
"Congress must seize the moment and any and all opportunities to finally provide a pathway to legalisation for millions of undocumented immigrants," he said.
Mr Biden has already proposed legislation that would provide a path to US citizenship for the estimated 11 million undocumented immigrants living in the US.
According to the Politico website, Democrats plan to create a way to citizenship for Dreamers and other undocumented groups in a forthcoming $3.5tn (£2.5tn) spending bill.
However, it is unclear whether the immigration provisions can get by the Senate's strict rules.
The legal blow to Daca comes on the day that the numbers of migrants arriving at the south-western border broke yet another record.
Border officials caught migrants there 188,829 times in June, the largest number in a single month in more than two decades.
This included over 15,000 children who were travelling alone, said US Customs and Border Protection.
Also on Friday the Pentagon confirmed to the BBC that Laughlin Air Force Base in Texas was being used by US immigration officials to fly undocumented migrants into the country's interior.