A decision blocking US president Donald Trump’s revised travel ban on people from six mainly Muslim nations was upheld yesterday by a US appeals court.

Appeal judges found that the executive order violated existing immigration legislation while ruling on a case brought by the state of Hawaii.

It is a further legal setback for the president’s efforts to get the ban he promised his supporters.

The 9th US circuit court of appeals in San Francisco cited a tweet from June 5 in which Trump had said: “We need a TRAVEL BAN for certain dangerous countries.”

However, Trump is now expected to ask the US Supreme Court to finally rule on the dispute.

The court of appeals effectively said that being from a certain country was no guarantee that somebody would be involved in terrorism.

The tweet formed part of a ruling that Trump had not provided a legally necessary “rationale explaining why permitting entry of nationals from the six designated countries under current protocols would be detrimental to the interests of the United States”.

By tweeting, the court said, he had betrayed his belief “that it is the ‘countries’ that are inherently dangerous, rather than the 180 million individual nationals of those countries who are barred from entry under the president’s ‘travel ban’.”

The courts have blocked two of Trump’s attempted travel bans, the second of which would have prevented the entry of people from Iran, Libya, Somalia, Sudan, Syria and Yemen for 90 days.

The first order also included Iraq and contained language suggesting that Christians would be given priority over Muslims, a provision judged to be unconstitutional.

The ruling also quoted White House press secretary Sean Spicer, who had said that Trump’s tweets should be “considered official statements by the president of the United States”.

US attorney general Jeff Sessions said he disagreed with the ruling.

“President Trump’s executive order is well within his lawful authority to keep the nation safe,” he said.

“Recent attacks confirm that the threat to our nation is immediate and real.”

The legal ruling came on the first anniversary of the Orlando nightclub shooting, in which a US citizen shot dead 49 people at a Florida nightclub – the worst mass shooting in US history.

More on Trump’s travel ban:

Donald Trump uses London terror attack to further calls for travel ban

WTTC chief slams Trump travel ban as ‘crazy’

Trump’s travel ban goes against “fundamental right” of freedom to travel