The US Supreme Court has ruled against the Trump administration's policy to deny asylum to any migrants crossing the US-Mexico border illegally.

The top court rejected the policy 5-4, with Chief Justice John Roberts siding with the court's liberals.

Federal judges had previously stayed the asylum ban, ruling it tried to circumvent existing laws granting anyone the right to asylum in the US.

The government had described the policy as a way to address the border crisis.

Conservative justices Neil Gorsuch, Clarence Thomas, Samuel Alito and Brett Kavanaugh dissented.

The court offered no opinion, just a document noting the order upholding the lower courts' ruling against the ban.

On 9 November, President Donald Trump issued a proclamation stating that only asylum claims made at official ports of entry would be heard.

Lower federal courts blocked the policy from going into effect soon after.

In Solicitor General Noel Francisco's request to the Supreme Court to give the proclamation the go-ahead, he claimed the president's decree was for border security and to discourage dangerous crossings.

The petition claimed that migrants entered the US illegally and then claimed asylum, allowing them to remain in the country while their cases were being processed - even if those cases were unlikely to be granted.

"These measures are designed to channel asylum seekers to ports of entry, where their claims can be processed in an orderly manner; deter unlawful and dangerous border crossings; and reduce the backlog of meritless asylum claims."

The government added that the temporary ban would "assist the president in sensitive and ongoing diplomatic negotiations" with Mexico, El Salvador, Guatemala and Honduras.

The American Civil Liberties Union (ACLU), which issued the legal challenge to the ban, said the policy was unjustifiable and unfair.

The ACLU noted that many legitimate asylum seekers, fearing for their lives, enter illegally "through no fault of their own".

"The government's statutory arguments boil down to the contention that it would be more 'rational' and 'sensible' to deny asylum to people who enter illegally. But Congress expressly rejected that argument," ACLU court documents stated.

The ACLU concluded that the administration was addressing "the wrong branch of government" with its request.

"It should make its case to Congress rather than seeking emergency intervention from this court regarding an almost 40-year-old statute."

What did the lower courts say?
Though the administration's ban was described as temporary, the lower courts ruled that it was not up to the White House to change existing federal laws in this way.

Under US law, there is a legal obligation to hear asylum claims from migrants if they say they fear violence in their home countries - regardless of how they have entered the country.

US District Judge Jon Tigar in California had first blocked Mr Trump's proclamation in November, and extended his order this month.

A panel of appeals court judges upheld that injunction.

Conservative Judge Jay Bybee wrote in the appeals opinion: "Just as we may not, as we are often reminded, 'legislate from the bench,' neither may the Executive legislate from the Oval Office", the Washington Post reported.

The latest group of migrants seeking entry into the US come from across Central America. They travelled north for weeks in what Mr Trump described as a "caravan of people".

They say they are fleeing persecution, poverty and violence in their home countries of Honduras, Guatemala and El Salvador.

In the run-up to the US mid-term elections, President Trump said most were criminals, called the caravan an invasion, and ordered troops to the border.

On Thursday, the Department of Homeland Security announced that any migrants who illegally enter the US - including asylum seekers - will have to wait in Mexico for their cases to be heard.

The Mexican government has said it will offer migrants work visas and protections while they await asylum proceedings, according to the US Department of State.