Writing for the majority, Chief Judge Roger L. Gregory said: "Congress granted the president broad power to deny entry to aliens, but that power is not absolute. It cannot go unchecked when, as here, the president wields it through an executive edict that stands to cause irreparable harm to individuals across this nation."
Attorney General Jeff Sessions said the Trump administration will file an appeal with the U.S. Supreme Court.
"President Trump's executive order is well within his lawful authority to keep the nation safe," Sessions said in a statement. "The Department of Justice strongly disagrees with the decision of the divided court, which blocks the president's efforts to strengthen this country's national security. As the dissenting judges explained, the executive order is a constitutional exercise of the president's duty to protect our communities from terrorism."
He added that the president "is not required to admit people from countries that sponsor or shelter terrorism, until he determines that they can be properly vetted and do not pose a security risk to the United States."
In the decision, Gregory said the executive order "speaks with vague words of national security, but in context drips with religious intolerance, animus and discrimination. Surely the Establishment Clause of the First Amendment yet stands as untiring sentinel for the protection of our most cherished founding principles -- that government shall not establish any religious orthodoxy, or favour or disfavour one religion over another."
In a strongly worded dissent, Judge Paul Niemeyer said that by taking into consideration statements "made by candidate Trump during the presidential campaign to conclude that the executive order does not mean what it says," the majority's ruling "is fraught with danger and impracticability."
"Apart from violating all established rules for construing unambiguous texts -- whether statutes, regulations, executive orders or, indeed, contracts -- reliance on campaign statements to impose a new meaning on an unambiguous executive order is completely strange to judicial analysis," he said.
"The simple fact of the matter is that regardless of any ulterior motive one might ascribe to the president, the record still conclusively establishes that the temporary travel pause will in fact promote an important national security objective," Niemeyer added.
The Trump administration has said the travel ban is not a "Muslim ban," but a policy designed to reduce the threat of a terrorist attack. "Each of these countries is a state sponsor of terrorism, has been significantly compromised by terrorist organizations, or contains active conflict zones," the executive order states.
"The real losers in this case," Judge Dennis Shedd said in his dissent, "are the millions of individual Americans whose security is threatened on a daily basis by those who seek to do us harm."
Trump's March 6 order, a revision of his original order issued Jan. 27, seeks to prevent citizens from six majority-Muslim countries from entering the United States for period of 90 days. The countries are Syria, Iran, Libya, Somalia, Sudan and Yemen; the revised order left out Iraq, which was named in the original order. It also asks that refugees wait 120 days before entering the country and cuts the number of refugees the U.S. accepts each year to 50,000. The U.S. previously had accepted up to 110,000.
On May 15, a three-judge panel of the 9th U.S. Circuit Court of Appeals heard arguments for and against an injunction placed on the order by a Hawaii federal court.
The U.S. bishops opposed the first travel ban as well as the second. In a March 6 statement, Bishop Joe S. Vasquez of Austin, Texas, who is chair of the U.S. Conference of Catholic Bishops' Committee on Migration, said the bishops are "deeply troubled by the human consequences" of the executive order, even in its revised form, particularly as it pertains to refugees.
"The revised order ... still leaves many innocent lives at risk," he said in the statement. "We are disappointed that the revised order maintains the temporary shutdown of the U.S. refugee admissions program, continues the more than 60 percent reduction in the number of refugees who can be resettled into the United States this year, and still temporarily bars nationals from six predominantly Muslim countries from entering the United States."