Washington (AFP) – A federal judge weakened the terms of the Trump administration’s controversial travel ban on visitors from six majority-Muslim countries, dealing another legal setback to the government.

Judge Derrick Watson in Hawaii ruled Thursday that grandparents and some other relatives of people in the United States should be exempt from the clampdown, saying the original terms of the ban defied common sense.

His decision was hailed as a victory by opponents of the ban, who say it singles out Muslims in violation of the US constitution.

The Trump administration insists the restrictions are necessary to keep out terrorists.

The US Supreme Court had allowed part of the ban to go into effect on June 29, putting an end, at least temporarily, to five months of politically charged skirmishes in the lower courts.

Specifically, the court allowed a 90-day ban on visitors from Iran, Libya, Somalia, Sudan, Syria and Yemen, and a 120-day ban on refugees, with exceptions for people with “close family relationships” in the United States.

The Trump administration defined that to be parents, spouses, children, sons- and daughters-in-law, siblings and step- and half-siblings.

But Watson found that “the Government’s narrowly defined list finds no support in the careful language of the Supreme Court or even in the immigration statutes on which the Government relies.

“Common sense, for instance, dictates that close family members be defined to include grandparents,” he wrote.

“Indeed, grandparents are the epitome of close family members. The Government’s definition excludes them. That simply cannot be.”

Watson ordered Homeland Security and the State Department not to enforce the ban on “grandparents, grandchildren, brothers-in-law, sisters-in-law, aunts, uncles, nieces, nephews, and cousins of persons in the United States.”

The judge also ruled that refugees who had assurances of a placement by a resettlement agency in the United States should also be exempt.

Such an assurance “meets each of the Supreme Court’s touchstones: it is formal, it is a documented contract, it is binding, it triggers responsibilities and obligations, including compensation, it is issued specific to an individual refugee only when that refugee has been approved for entry by the Department of Homeland Security, and it is issued in the ordinary course, and historically has been for decades,” Watson wrote.

“Bona fide does not get any more bona fide than that.”

Douglas Chin, attorney general for the state of Hawaii, which filed the lawsuit against the Trump administration, welcomed the ruling.

“The federal court today makes clear that the US Government may not ignore the scope of the partial travel ban as it sees fit,” said Chin.

“Family members have been separated and real people have suffered enough. Courts have found that this Executive Order has no basis in stopping terrorism and is just a pretext for illegal and unconstitutional discrimination.”

The Departments of Homeland Security, State and Justice did not immediately respond to requests for comment early Friday.

Under the version of the travel ban allowed to go forward by the Supreme Court, citizens from the six targeted countries with “bona fide” ties to the United States — such as a job or acceptance to a university — are permitted entry.

The high court will review the overall case in October, after both bans on travelers and refugees have largely run their course.

While the ban itself did not single out Muslims, judges in lower courts had cited Trump’s repeated statements during last year’s presidential race that he intended to ban Muslims from entering the United States.

His original measure, issued by executive order in January, set off chaos and protests at airports and was almost immediately blocked by the courts.