A US federal appellate court upheld an injunction issued by a lower court blocking enforcement of President Donald Trump's executive order barring issuance of visas to residents of six Muslim-majority countries.

The 4th Circuit Court of Appeals, based in Virginia, voted 10-3 on Thursday to uphold a ruling by a federal judge in Maryland who declared in March that the President's revised travel order amounted to unconstitutional religious discrimination, NBC news reported.

"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," said Chief Judge Roger L. Gregory.

The Justice Department urged the court to lift the ban on enforcement. It said the executive order had a legitimate national security purpose, allowing the government to assess the reliability of background information on visa applicants from six countries associated with terrorism.

But that argument, the court said, "is belied by evidence in the record that President Trump issued the first executive order without consulting with the relevant security agencies."

Among the alterations made in the revised order were the removal of Iraq from the list of targeted nations and an exemption for lawful permanent residents and travelers who obtained US visas ahead of the January 27 announcement.

The revised order also did not indefinitely bar Syrian refugees from entering the US.

In Thursday's decision, the appellate court explicitly referred to Trump's advocacy of a Muslim ban during the 2016 presidential campaign.

"The evidence in the record, viewed from the standpoint of the reasonable observer, creates a compelling case that (the executive order's) primary purpose is religious," the 4th Circuit said.

"Then-candidate Trump's campaign statements reveal that on numerous occasions, he expressed anti-Muslim sentiment, as well as his intent, if elected, to ban Muslims from the United States," it added.

Trump's March 6 executive order sought to ban people from Iran, Libya, Somalia, Sudan, Syria, and Yemen from entering the US for 90 days and to bar all refugees for 120 days.