Image copyright Reuters Image caption The ruling confirms that grandparents and other relatives of people in the US can visit

The US Supreme Court has rejected an attempt by President Donald Trump to include grandparents and other relatives of US residents in his travel ban on people from six countries.

But the judges also gave the government the right to enforce a separate ban on refugees, pending a government appeal against a federal court order.

Both items were part of an executive order issued by Mr Trump on 6 March.

He says the move is vital for national security.

Critics counter that it is discriminatory and unfair.

A federal judge ruled against the Trump administration on both issues last week, leading it to seek the intervention of the Supreme Court.

Wednesday's Supreme Court decision means grandparents, grandchildren, aunts, uncles, nieces, nephews, cousins, and siblings-in-law of those legally residing in the US are not covered by the current 90-day bar on the entry of people from from six Muslim-majority nations: Iran, Libya, Somalia, Sudan, Syria and Yemen.

'Grandparents, not terrorists'

Hawaii Attorney General Douglas Chin, who challenged both bans in court, said the Supreme Court ruling endorsed Hawaii's position.

"This confirms we were right to say that the Trump administration overreached in trying to unilaterally keep families apart from each other," he said in a statement.

The Supreme Court's decision on the refugee ban could prevent the entry of up to 24,000 refugees connected to a US Resettlement Agency. Mr Trump's 50,000 cap on refugee admissions for the year, part of the executive order, has already been reached.

This latest legal ruling is temporary while the Ninth Circuit Court of Appeals considers the government's appeal against a lower court ruling that upheld Hawaii's challenge to the ban.

But Naureen Shah of Amnesty International USA said the decision "jeopardises the safety of thousands of people across the world including vulnerable families fleeing war and violence".

Courtroom tussles

This is just the latest round in an ongoing battle over Mr Trump's executive order, which began after Supreme Court intervention last month partly reinstated the ban on refugees and travellers from the six Muslim-majority countries.

It said only those with "bona fide" family ties would be let into the US.

But the Trump administration decided that did not include grandparents, grandchildren, brothers-in-law, sisters-in-law, uncles, aunts, nephews, nieces and cousins.

The federal judge who ruled against this condemned the government's definition of a close relative as "unduly restrictive".

Media playback is unsupported on your device Media caption The Trump voters caught up in the crackdown

An initial version of the ban, published in January, sparked mass protests at airports and a series of legal challenges that prevented its implementation.

Mr Trump drafted a new version in March, dropping Iraq from the list of countries, clarifying the position of "green card" holders, removing priority for "religious minorities" in mostly-Muslim countries, and softening a tough stance on Syrian refugees.

But courts struck down the new version within days, with a Virginia court claiming it was "rooted in religious animus" against Muslims.

That prompted the Trump administration to go to the Supreme Court for a ruling, where conservatives hold a majority of five to four.

The nation's highest court allowed the ban to go ahead temporarily, until it makes a full decision in October.