The appeals court leans to the left, with two of the three members appointed by Democrats, but the Supreme Court is more evenly balanced, with four justices nominated by Democrats, and four nominated by Republicans.

Constitutional experts are divided on the legality of the ban, and federal courts have issued contradictory rulings about it. On the same day that a judge in Seattle blocked the executive order, a judge in Boston ruled Mr Trump was within his power to issue it.

He said on Thursday Mr Trump was “very proud” of selecting Mr Gorsuch, and the “demoralising” comment was in reference to the judge's “general philosophy”, rather than a response to anything Mr Trump had said.

Mr Spicer also declared that Mr Trump had “no regrets” over his attacks on the federal judges tasked with ruling on the order, insisting “the president has the right to speak his mind”.

He said Mr Trump would continue to make similar attacks on judges when he saw fit, claiming criticism of the judiciary “goes back to Thomas Jefferson”.

“He is free to speak his mind,” Mr Spicer said. “Where has the outrage been over the past 100 years?”

Mr Trump, meanwhile, lambasted the Democratic senator who first revealed that Mr Gorsuch had made the remarks:

Sen.Richard Blumenthal, who never fought in Vietnam when he said for years he had (major lie),now misrepresents what Judge Gorsuch told him?

They also noted that the government had not proved the law would save American lives, or that “any alien from any of the countries named in the Order has perpetrated a terrorist attack in the United States.

“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,” the judges wrote.

The court found Mr Trump’s proposal of a “Muslim ban” during the primary elections was permissible as evidence that the order was designed to be discriminatory.

The White House did not comment immediately after the ruling, beyond Mr Trump's comment that "the security of our nation is at stake", but the president’s legal team had reportedly gathered to review it.

The Democratic National Committee issued a gleeful statement following the ruling.

“Let’s be clear: this is a massive blow to the White House. The court upheld that we do not discriminate based on religion. That is what terrorists do, and what terrorists want us to do,” it read.