A federal appeals court based in San Francisco has decided against reinstating President Donald Trump's sweeping travel ban on visitors from seven Muslim-majority nations and refugees from around the world.

In a unanimous 29-page decision issued Thursday, the 9th Circuit Court of Appeals rejected the Trump administration's request to lift a temporary restraining order issued by a federal judge in Seattle.

"On the one hand, the public has a powerful interest in national security and in the ability of an elected president to enact policies," the court said in its opinion. "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. We need not characterize the public interest more definitely than this; when considered alongside the hardships discussed above, these competing public interests do not justify a stay."

Trump reacted on Twitter minutes after the ruling became public.

“SEE YOU IN COURT,” he tweeted, “THE SECURITY OF OUR NATION IS AT STAKE!”

Trump's decree sowed massive confusion at airports across the nation, sparking lawsuits and angry protests. Citing Trump's order, federal immigration authorities temporarily detained 11 international travelers at Hartsfield-Jackson Atlanta International Airport on Jan. 28, some for several hours. A day later, thousands of demonstrators gathered at the Atlanta airport to protest the travel ban.

The three-judge appeals court panel that heard the case in San Francisco included William C. Canby Jr., a President Jimmy Carter appointee; Richard R. Clifton, a President George W. Bush appointee; and Michelle T. Friedland, a President Barack Obama appointee.

Aimed at preventing terrorism in the U.S., Trump's decree halts travel to the U.S. for 90 days from Iraq, Syria, Iran, Sudan, Libya, Somalia and Yemen. It also puts the refugee resettlement program on hold for 120 days. And it indefinitely bars Syrian refugees from coming here.

The states of Washington and Minnesota sued to stop the ban, arguing it is hurting their economies and universities and that it violates the First Amendment’s ban on government establishment of religion. The states pointed out that Trump campaigned on barring all Muslims from entering the U.S. Parts of his executive order, according to the states, are “intended to disfavor Islam and favor Christianity.” Trump has denied his executive order is a “Muslim ban.”

Following the decision, Washington State Attorney General Bob Ferguson told The Washington Post, “Bottom line, this is a complete victory for the state of Washington." He said the judge’s ruling “effectively granted everything we sought.”

Trump’s order, signed Friday, suspends all refugee entries for 120 days.

The state’s attorneys argued in court papers that immigration is an important economic driver for Washington. For example, many workers in Washington’s technology industry are immigrants, they said, and many of them are from Muslim-majority countries. Businesses owned by immigrants and refugees employ 140,000 people in Washington. Washington-based companies including Microsoft, Amazon, Expedia and Starbucks employ thousands of foreign guest workers.

“It has always been the judicial branch’s role to say what the law is and to serve as a check on abuses by the executive branch,” Noah Purcell, solicitor general for the state of Washington, told the appeals court this week. “That judicial role has never been more important in recent memory than it is today. But the president is asking this court to abdicate that role here to reinstate the executive order without meaningful judicial review and to throw this country back into chaos.”

The Trump administration has argued the lower court’s restraining order violates the nation’s separation of powers and second-guesses the president’s national security judgment. The president’s authority in this area is “unreviewable,” the government has argued in court papers.

“This judgment was well within the president’s power and delegated to him by Congress and it is constitutional,” August Flentje, special counsel to the U.S. assistant attorney general, told the appeals court.

The appeals court pushed back against the government's claim.

"There is no precedent to support this claimed unreviewability, which runs contrary to the fundamental structure of our constitutional democracy," it said in its ruling. "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 court did not rule on whether the ban was constitutional and the case will almost certainly end up in the U.S. Supreme Court. A 4-4 tie on the nation’s top court - which is still short a justice after the death last year of Antonin Scalia - would leave the appeals court ruling in place.

Since the Sept. 11 terrorist attacks, no one in the U.S. has been killed by extremists with family backgrounds in the seven countries covered in the travel ban, according to a report published this month by Charles Kurzman, a sociology professor at the University of North Carolina and a specialist in Islamic movements. Entitled "Muslim-American Involvement with Violent Extremism," the report says only 23 percent of Muslim-Americans involved in violent extremist plots during that timeframe had family backgrounds in those countries.

The Cato Institute, a libertarian group based in Washington, released a report just two days before Trump signed his executive order. It says that between 1975 and 2015, no one from the seven countries covered in the travel ban killed any Americans in terrorist attacks on U.S. soil. Six Iranians, six Sudanese, two Somalis, two Iraqis, and one Yemini, according to the report, were convicted of attempting or carrying out terrorist attacks here during that timeframe. Further, the annual chance of an American dying in a terrorist attack committed by a refugee is one in 3.6 billion, the report says.

The appeals court zeroed in on such issues in its ruling issued Thursday.

“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 court’s decision says. “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. We disagree.”