A federal judge in Hawaii has put President Donald Trump's revised travel ban on hold, issuing an emergency halt to the order just hours before it was set to go into effect.

The ruling by US District Judge Derrick Watson on Wednesday prevents the executive order from going into effect on Thursday.

Hawaii argued that the new order will harm its Muslim population, tourism and foreign students. Ismail Elshikh, a plaintiff in the lawsuit, said the ban would prevent his Syrian mother-in-law from visiting.

Watson concluded in his ruling that while the order did not mention Islam by name, "a reasonable, objective observer ... would conclude that the executive order was issued with a purpose to disfavour a particular religion".

Speaking at a rally in Nashville, Trump called his revised executive order a "watered-down version" of his first.

"I think we ought to go back to the first one and go all the way, which is what I wanted to do in the first place," Trump said.

He called the judge's block "unprecedented judicial overreach" and said he will take the case "as far as it needs to go," including to the US Supreme Court.

The Hawaii case was one of several that were moving through US courts on Wednesday brought by states' attorneys general and immigrant advocacy groups.

Refugee resettlement agencies suing the government asked a federal judge at a hearing in Maryland to block the ban, arguing it discriminates on the basis of religion and violates the US constitution.

EXPLAINED: How could Hawaii block Trump's travel ban?

The president's executive order, which the administration says is necessary for national security, temporarily bars the entry of most refugees as well as travellers from six Muslim-majority countries.

It replaces a January 27 order that Trump abandoned after it was blocked in court last month.

Government attorneys argued that the replacement was revised substantially to address legal concerns, including the removal of an exemption for religious minorities from the affected countries.

"It doesn't say anything about religion. It doesn't draw any religious distinctions," said Jeffrey Wall, who argued for the justice department.

Attorneys for the American Civil Liberties Union and other groups said that Trump's statements on the campaign trail and statements from his advisers since he took office make clear that the intent of the ban is to ban Muslims.

Trump policy adviser Stephen Miller has said the revised order was designed to have "the same basic policy outcome" as the first.

The new version of the ban affects fewer people than the initial ban.

It applies only to new visas from Somalia, Iran, Syria, Sudan, Libya and Yemen. It does not apply to travellers who already have visas, or to green-card holders. Iraq, included in the first ban, was excluded.

The next step in the legal battle will be for the Trump administration to take the case to the 9th Circuit Court of Appeals, which will either uphold or cancel the temporary restraining order.

Courts will look at the intent of the law, not only the words of the executive order, said Danielle McLaughlin, a constitutional law scholar.

"Trump's campaign rhetoric was pivotal in the Hawaii court's decision, as it was in the earlier decisions halting his first travel ban," she told Al Jazeera.

"During his campaign, Trump promised a ban on Muslims entering the country. This is discrimination on the basis of religion, which is unconstitutional."

Besides discriminating against Muslims, the Maryland lawsuit argues that it is against federal law for the government to reduce the number of refugees allowed into the United States this year by more than half, from 110,000 to 50,000.

Attorneys argued that if that aspect of the ban takes effect, 60,000 people would be stranded in war-torn countries with nowhere else to go.

OPINION: How Muslim Ban incites vigilante Islamophobic violence

In Washington state, US District Judge James Robart - who halted the original ban last month - heard arguments in a lawsuit brought by the Northwest Immigrant Rights Project, which is making arguments similar to the American Civil Liberties Union in the Maryland case.

Robart is also overseeing the legal challenge brought by Washington state. Attorney General Bob Ferguson argues that the new order harms residents, universities and businesses, especially tech companies such as Washington state-based Microsoft and Amazon, which rely on foreign workers.

California, Maryland, Massachusetts, New York and Oregon have joined the claim.

Washington and Hawaii say the order also violates the First Amendment, which bars the government from favouring or disfavoring any religion. On that point, they say, the new ban is no different from the old.