The unanimous ruling from a three-judge panel means that citizens of seven majority-Muslim countries will continue to be able to travel to the US, despite Trump's executive order last month.
It is a significant political setback to Trump's new administration and raises questions about how the courts will view his apparent vision for an expansive use of executive power from the Oval Office on which he is anchoring the early weeks of his presidency.
"The government has pointed to no evidence that any alien from any of the countries named in the order has perpetrated a terrorist attack in the United States," the judges wrote.
"Rather than present evidence to explain the need for the Executive Order, the government has taken the position that we must not review its decision at all."
The judges added that while "the public has a powerful interest in national security and in the ability of an elected president to enact policies... the public also has an interest in free flow of travel, in avoiding separation of families, and in freedom from discrimination."
Trump immediately tweeted his reaction to the ruling: "SEE YOU IN COURT, THE SECURITY OF OUR NATION IS AT STAKE!"
"It's a political decision, we're going to see them in court, and I look forward to doing that," Trump told reporters in the White House Thursday. "It's a decision that we'll win, in my opinion, very easily."
Trump's presidential rival Hillary Clinton celebrated the decision, tweeting simply "3-0."
The states of Washington and Minnesota had challenged the ban.
"Bottom line, this is a complete victory for the state of Washington," said state Attorney General Bob Ferguson. "The 9th Circuit Court of Appeals in a unanimous decision effectively granted everything we sought."
Washington state Solicitor General Noah Purcell, who argued the case, responded to Trump's tweet on CNN's "Erin Burnett OutFront."
"The irony from our perspective is that we've seen him in court twice now, and we've won both times. It's not like it doesn't count until you get to the Supreme Court," Purcell said.
The Justice Department is reviewing the decision, it said in a statement.
But given that the Supreme Court currently lacks its ninth member, there a real chance of a 4-4 split on the bench along ideological lines, which would have the effect of affirming the ruling of the 9th Circuit, inflicting a more permanent blow to the new administration.
Fight over executive power
The legal drama over the immigration executive order was the first episode in what could be a series of legal challenges to Trump's governing style and agenda and represents the first confrontation between his White House and the checks and balances of the American political system.
The judges addressed each of the Justice Department's proffered reasons for reinstating the ban in great detail and rejected them all.
Perhaps the most sweeping language came concerning the government's vast claim of executive power.
The court rejected that in strong language: "There is no precedent to support this claimed unreviewability, which runs contrary to the fundamental structure of our constitutional democracy."
They added: "Although our jurisprudence has long counseled deference to the political branches on matters of immigration and national security, neither the Supreme Court nor our court has ever held that courts lack the authority to review executive action in those arenas for compliance with the Constitution."
The administration also argued the states did not have standing -- or the legal right -- to bring the suit.
But the court disagreed.
"(A)s the operators of state universities, the states may assert not only their own rights to extent affected by the Executive Order but may also assert the rights of their students and faculty members," the judges wrote.
National security argument
The court also chastised the Trump administration for failing to provide an explanation for how national security concerns justified an "urgent need" for the executive order to be immediately reinstated.
It suggested the administration "could have provided the court "with classified information" but failed to do so.
And while the administration had set forth a fallback argument in order to limit the scope of the temporary restraining order currently in place -- arguing that if the judges were inclined to uphold the lower court's decision to block Trump's ban, then the ruling should at least be limited to people who have previously been admitted to the US -- the appellate court was unconvinced.
"It is not our role to try, in effect, to rewrite the Executive Order. ...The political branches are far better equipped to make appropriate distinctions," the court explained.
The court said that it had to look at the interest of the public. It acknowledged that the public had a "powerful interest" in national security and in the "ability of an elected president to enact policies" but that the states had a stronger argument.
"The public has an interest in free flow of travel, in avoiding separation of families, and in freedom from discrimination," the judges wrote.
Trump's executive order bars citizens of Iraq, Syria, Iran, Libya, Somalia, Sudan and Yemen from entering the US for 90 days, all refugees for 120 days and indefinitely halts refugees from Syria.
Trump issued the travel ban January 27, causing chaos, confusion and protests at international airports as the legal status of people in transition was suddenly thrown into question. Lawsuits have been filed across the country, but it was one from federal Judge James Robart in Seattle last Friday that blocked the travel ban nationwide, clearing the way for resumed travel from the seven countries.
The administration appealed, and the three-judge panel heard oral arguments Tuesday evening via telephone and issued the ruling Thursday per curiam, meaning it is unsigned and there was no dissent. Judge Michelle T. Friedland, who was appointed by President Barack Obama, Judge William C. Canby Jr, an appointee of President Jimmy Carter, and Judge Richard R. Clifton, an appointee of President George W. Bush, heard the case.
"The Trump administration has lost dramatically and completely," said Jeffery Toobin, a CNN political analyst, on "The Situation Room."
"This decision will have a lot more public credibility because it is unanimous, and I think it complicates the Trump administration's attempt, if they choose to make it, to disparage this decision as a political act," Toobin said.
The administration has not announced its next step, but Trump has previously indicated that he would take the case all the way to the Supreme Court if necessary, a move that would set up a legal showdown of even higher stakes and visibility.
Should it choose, before it goes to the Supreme Court, the Justice Department has the option of asking for an en banc review of the three-judge panel ruling among judges of the full 9th Circuit.