A US appeals court has rejected President Donald Trump’s attempt to reinstate his ban on citizens from seven mainly Muslim countries.
The 9th US Circuit Court of Appeals said it would not block a lower-court ruling that halted the order.
Mr Trump responded with an angry tweet saying national security was at risk and there would be a legal challenge.
But the 3-0 unanimous ruling said the government had not proved the terror threat justified reviving the ban.
The ruling means that people from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen with visas can continue to enter the US.
And refugees from around the world, who were also subject to a temporary ban, are no longer blocked either.
The case is now likely to end up at the highest court, the US Supreme Court.
What did the three appeal judges say?
They rejected the argument, made by the Justice Department on behalf of the US government, that the president had sole discretion to set immigration policy.
The court also said there was “no evidence that any alien from any of the countries named in the order” had committed a terror attack in the US.
They said both sides had made compelling cases.
“On the one hand, the public has a powerful interest in national security and in the ability of an elected president to enact policies.
“And on the other, the public also has an interest in free flow of travel, in avoiding separation of families, and in freedom from discrimination.”
But they said Mr Trump’s executive order stripped foreign arrivals of their rights under the Constitution.
What has the reaction been?
Mr Trump responded to the ruling by tweeting his dissent, and then gave an audio statement saying it was a political decision.
The Justice Department, which made representations to the appeals court on behalf of the White House, said in a statement it was “reviewing the decision and considering its options”.
Washington State Attorney General Bob Ferguson, who had sued over the ban, said it was a complete victory for the state.
New York City Mayor Bill De Blasio said: “Here in New York – the safest big city in America – we will always protect our neighbours, no matter where they came from or when they got here. Those are our values.”
What it all means – Anthony Zurcher, BBC News, Washington
Donald Trump’s lawyers did not make their case. In fact, according to three Ninth Circuit judges, they didn’t even really try to make their case. Rather than explaining why the temporary travel ban was needed, the administration argued that the president’s authority on immigration was so sweeping that they didn’t have to explain why the order was necessary.
According to the court, the government was unable to say why Mr Trump’s ban addressed a pressing national security threat that a temporary stay of the order would worsen. The lawyers for the challenging states, on the other hand, convinced the judges that re-imposing the order at this point would create further chaos by infringing on the due process rights of those on US soil, regardless of their immigration status.
By issuing a unanimous, unsigned opinion, the judges avoid accusations of partisan bias, as one of the three was a Republican appointee.
Mr Trump tweeted a sharp “SEE YOU IN COURT” following the decision – but which court?
An appeal to the Supreme Court seems likely, although a better move for the president may be to fight in the lower court until Judge Neil Gorsuch joins a conservative majority on the bench.
How did we get here?
The executive order, at the end of Mr Trump’s first week in office, had sparked protests and confusion as people were stopped at US borders.
Then a week later, a federal judge in Seattle issued a temporary restraining order that stopped the ban in its tracks, after Washington state and Minnesota sued.
The Justice Department appealed to the 9th Circuit in San Francisco, which heard oral arguments this week.
Lawyers representing the US government argued that the ban was a “lawful exercise” of presidential authority.
But the two US states said the ban had harmed universities in their states and discriminated against Muslims.
The appeal judges did not rule on the constitutionality or the merits of the law, just on the question of its reinstatement.
The lower court in Seattle must still debate its merits and there are other legal challenges across the country.
–