A US judge in Seattle has issued a temporary nationwide block on President Donald Trump’s ban on travellers from seven mainly Muslim nations.
Federal Judge James Robart ruled against government lawyers’ claims that US states did not have the standing to challenge Mr Trump’s executive order.
Last week’s order has led to protests and confusion at US airports. Some 60,000 visas have since been revoked.
The Justice Department now plans to file an emergency stay of the ruling.
In a statement, the White House described Mr Trump’s directive as “lawful and appropriate”.
“The president’s order is intended to protect the homeland and he has the constitutional authority and responsibility to protect the American people,” the statement said.
Mr Trump’s order brought in a suspension of the US Refugee Admissions Programme for 120 days.
There is also an indefinite ban on Syrian refugees. Anyone arriving from Iraq, Syria, Iran, Libya, Somalia, Sudan or Yemen faces a 90-day visa suspension.
The lawsuit against President Trump’s ban was initially filed by Washington state, with Minnesota joining later.
Washington State Attorney General Bob Ferguson has described the ban as illegal and unconstitutional, because it discriminates against people on the ground of their religion.
The ruling is a major challenge to the Trump administration, and means that nationals from the seven countries are now able – in theory – to apply for US visas, the BBC’s David Willis in Washington DC reports.
The administration can also appeal against the verdict.
President Trump has argued that his directive is aimed at protecting America.
He said visas would once again be issued once “the most secure policies” were in place, and denied it was a Muslim ban.
A number of state attorney generals have said the order is unconstitutional. Several federal judges have temporarily halted the deportation of visa holders, but the Seattle ruling is the first to be applicable nationwide.
Courts in at least four other states – Virginia, New York, Massachusetts and Michigan – are hearing cases challenging Mr Trump’s executive order.
Earlier on Friday, a judge in Boston declined to extend a temporary ban that prohibited the detention or removal of foreigners legally authorised to come to America.
The ban – which only applied to Massachusetts – is due to expire on 5 February.