The Supreme Court turned back the Trump administration's attempt to enforce a ban on granting asylum requests to illegal immigrants on the basis of where they enter the United States.

Lower courts had blocked President Donald Trump's executive order that denied asylum opportunities to people who jumped the border in between official entry points between the U.S. and Mexico.

But in a 5-4 ruling, the nation's highest court said that's an unacceptable way to limit immigration.

Justice Brett Kavanaugh, Trump's latest appointee, sided with the minority. Chief Justice John Roberts voted against the administration, joining the court's four most liberal members.

Justice Ruth Bader Ginsburg voted from her hospital bed, where she was recovering from surgery to remove cancerous nodes from her lungs.

Chief Justice of the United States John Roberts (right, pictured with justices Elena Kagan, Clarence Thomas and Samuel Alito, sided with liberal justices against the Trump administration on Friday, turning back an appeal of a lower court ruling that blocked one of the president's policies on asylum-seeking illegal immigrants

Trump got into a war of words with Roberts last month after blaming an 'Obama judge' for the initial ruling that the Wupre Court allowed to stand on Friday

Trump's policy was meant to limit the incentive for illgeal immigrants to enter the country by denying them the chance to apply for aslylum unless they came in through an official border crossing

Neither side issued written opinions describing their rationale for blocking the administration's appeal.

While the case advanced through the federal courts, the Homeland Security and Justice Departments announced a separate policy that keeps migrants on the Mexican side of the border, instead of releasing them into the interior of the country, while they await asylum hearings.

It's unclear if Friday's ruling will affect that policy's implementation, although Mexico has agreed to cooperate.

The Supreme Court's action upheld a ruling by U.S. District Judge John Tigar, who drew Trump's ire by issuing an injunction to stop the selective asylum-granting from taking effect.

Tigar's order came in a lawsuit that could still take a year or more to resolve; Friday's decision concerned only the temporary hold Tigar put on the policy while the suit proceeds.

Trump's November executive order was meant to slow down the flow of illegal immigrants hopping the border, including caravans of thousands of Central Americans traveling the length of Mexico

The U.S. Supreme Court consists of (front, L-R) Stephen Breyer, Clarence Thomas, Chief Justice John Roberts, Ruth Bader Ginsburg, Samuel Alito and (back, L-R) Neil Gorsuch, Sonia Sotomayor, Elena Kagan, and Brett Kavanaugh

Tigar found that federal law allows immigrants to request asylum status no matter how they reach U.S. soil.

That Nov. 19 ruling drew an exasperated Trump to lash out at him as an 'Obama judge,' leading Roberts to issue a rare personal rebuke of the president.

'We do not have Obama judges or Trump judges, Bush judges or Clinton judges,' Roberts said in a statement distributed by the Supreme Court. 'What we have is an extraordinary group of dedicated judges doing their level best to do equal right to those appearing before them.'

Trump was on the golf course in Palm Beach, Florida at the time and tweeted his response.

'Sorry Chief Justice John Roberts, but you do indeed have “Obama judges,” and they have a much different point of view than the people who are charged with the safety of our country,' he wrote.

'It would be great if the 9th Circuit was indeed an “independent judiciary”,' he added, 'but if it is why are so many opposing view (on Border and Safety) cases filed there, and why are a vast number of those cases overturned.'

During a Thanksgiving Day call with American troops serving in Afghanistan, the president blamed the famously liberal Ninth Circuit courts for stymieing his plans.

There is a years-long backlog of asylum cases in the U.S., meaning immigration officials typically allow applicants to remain in the country while they wait – something Trump is also changing

'We got a lot of bad decisions from the Ninth Circuit, which has become a big thorn in our side. We always lose, and then you lose again and again, and you hopefully win at the Supreme Court,' he said.

Trump's latest policy directives came in response to caravans of Central Americans making their way through Mexico.

While some are likely genuine asylum cases, many are in search of work in the United States.

Only about 15 per cent of asylum seekers who cross into the U.S. illegally are ultimately granted that status once judges hear their cases.

The judicial backlog, however, stood at more than 311,000 at the beginning of 2018.

Friday's Supreme Court order came at a tense moment when Trump was trying to outmaneuver Senate Democrats on a government funding package whose failure could shut a quarter of the government at midnight.

The central issue of that conflict is the president's long-sought border wall between Mexico and the United States. He has insisted that it's a needed measure to shore up border security.