The Supreme Court on Friday blocked the Trump administration from immediately enforcing a strict new asylum policy, in a 5-4 decision that marks the second legal setback this week for efforts to tighten immigration rules.

The court, in a brief written order, denied a bid to begin enforcing an asylum ban for any immigrants who illegally cross the U.S.-Mexico border.

The decision leaves in place lower-court rulings that blocked the administration from automatically denying asylum to people who do not go through official border crossings. An open-ended nationwide injunction on enforcement issued by a San Francisco-based federal judge this week prompted the Justice Department to seek immediate relief from the Supreme Court.

CLICK HERE TO GET THE FOX NEWS APP

Chief Justice John Roberts provided the critical vote against the administration Friday, siding with the four liberal justices. Newly confirmed Justice Brett Kavanaugh and three other conservatives on the bench sided with the administration, the order said.

Justice Ruth Bader Ginsburg, despite having surgery in New York on Friday to remove cancerous nodules in her lung, apparently voted with the majority, avoiding a 4-4 tie.

The current legal challenge originated in California, where the 9th U.S. Circuit Court of Appeals also recently ruled against the administration and said the policy was likely “inconsistent” with existing law.

Trump has said he was acting in response to caravans of migrants making their way to the border.

The Supreme Court order comes after a federal judge in a separate case took the extraordinary step this week of ordering that asylum seekers who sued after their deportation be returned to the U.S. to have their claims heard anew.

NIELSEN ANNOUNCES ASYLUM DEAL WITH MEXICO

U.S. District Judge Emmet Sullivan, in doing so, blocked policies that could prevent immigrants who claim to have suffered gang violence or domestic abuse in their home countries from seeking asylum.

The White House said in response that Wednesday’s ruling “will further overwhelm our immigration courts with meritless cases, making the existing massive backlog even worse.”

Despite setbacks in the courts, the administration is moving forward with other changes.

Department of Homeland Security Secretary Kirstjen Nielsen announced Thursday that the U.S. has secured an agreement with Mexico so that immigrants claiming asylum will be returned to Mexico as their cases are processed -- a bid to end the practice known as “catch-and-release.”

Nielsen made the announcement at a House Judiciary Committee hearing, telling the committee that the goal is to crack down on migrants falsely claiming asylum, only to be released into the U.S. and escape the radar of immigration officials.

“But by the time the courts have issued their orders, most of these illegal aliens have vanished within our country for good,” she said. “They have escaped the law, undermined the system, and made it harder for us to actually help real asylum-seekers by flooding the system with false claims.”

Fox News’ Adam Shaw and The Associated Press contributed to this report.