A divided US appeals court late Friday refused to immediately allow the Trump administration to enforce a ban on asylum for any immigrants who illegally cross the US-Mexico border.

The ban was inconsistent with an existing US law and an attempted end-run around Congress, a panel of the ninth US circuit court of appeals said in a 2-1 decision.

“Just as we may not, as we are often reminded, ‘legislate from the bench’, neither may the executive legislate from the Oval Office,” Judge Jay Bybee, a George W Bush nominee, wrote for the majority.

A spokesman for the US Department of Justice, Steven Stafford, did not have comment. But he referred to an earlier statement that called the asylum system broken and said the department looked forward to “continuing to defend the executive branch’s legitimate and well-reasoned exercise of its authority to address the crisis at our southern border”.

At issue is Donald Trump’s 9 November proclamation that barred anyone who crossed the US-Mexico border between official ports of entry from seeking asylum. Trump issued the proclamation in response to caravans of migrants approaching the border.

A lower court judge temporarily blocked the ban and later refused to immediately reinstate it. The administration appealed to the ninth circuit for an immediate stay of Judge Jon Tigar’s 19 November temporary restraining order.

In a dissenting opinion on Friday, Judge Edward Leavy said the administration “adopted legal methods to cope with the current problems rampant at the southern border”. Nothing in the law the majority cited prevented a rule categorically barring eligibility for asylum on the basis of how a person entered the country, Leavy, a Ronald Reagan nominee, said.

In his 19 November ruling, Tigar sided with legal groups who argued that federal law was clear that immigrants in the US could request asylum regardless of whether they entered legally.

The president “may not rewrite the immigration laws to impose a condition that Congress has expressly forbidden”, the judge said in his order.