President Donald Trump's most recent effort to curtail immigration was dealt another judicial setback Thursday by a federal appeals court in Virginia.

In a 9-4 decision, the court ruled that Trump’s travel ban is unconstitutional because it discriminates against Muslims.

The majority ruling cited Trump's Twitter posts and other public statements as evidence that the stated intent behind the executive order -- national security -- is mere window dressing for its true intent.

"Examining official statements from President Trump and other executive branch officials, along with the Proclamation itself, we conclude that the Proclamation is unconstitutionally tainted with animus toward Islam," Chief Judge Roger Gregory wrote.

Those appealing the executive order "offer undisputed evidence that the President of the United States has openly and often expressed his desire to ban those of Islamic faith from entering the United States", Gregory wrote.

The latest version of the travel ban blocks people from eight countries -- six of which are Muslim-majority -- from U.S. entry. It bars immigration from Chad, Iran, Libya, Somalia, Syria and Yemen as well as North Korea and Venezuela.

"President Trump’s third illegal attempt to denigrate and discriminate against Muslims through an immigration ban has failed in court yet again. It’s no surprise. The Constitution prohibits government actions hostile to a religion," she said in a statement.

As a candidate running for America's highest office, Trump pledged to enact "a total and complete shutdown of Muslims entering the United States until our country's representatives can figure out what the hell is going on".

While in office, he has put out three separate attempts to fulfill the promise but has been dealt successive legal setbacks.

The Supreme Court allowed the third version to go into effect while legal proceedings continued.