WASHINGTON (Reuters) - The U.S. Justice Department filed an appeal late Saturday to restore President Donald Trump’s immigration order barring citizens from seven mainly Muslim countries and temporarily banning refugees, even as travelers raced to enter the country while the ban was lifted.

Police officers stand guard as demonstrators in support of the immigration rules implemented by U.S. President Donald Trump's administration, protest at Los Angeles international airport in Los Angeles, California, U.S., February 4, 2017. REUTERS/Ringo Chiu

The government moved to reverse a federal judge’s Friday order that lifted the travel ban and warned the decision posed an immediate harm to the public, thwarted enforcement of an executive order and “second-guesses the president’s national security judgment about the quantum of risk posed by the admission of certain classes of (non-citizens) and the best means of minimizing that risk.”

Friday’s ruling prompted Trump to denounce the “so-called” judge in a series of tweets on Saturday..

The appeal now goes to a three-judge panel which can act at anytime to uphold the order or suspend it pending a full appeal. A Justice Department spokesman declined to comment beyond the filing.

A ruling could come at any time.

Seattle U.S. District Judge James Robart’s decision barred the administration from enforcing the sweeping order that also indefinitely barred Syrian refugee admissions and prompted large protests across the United States.

Trump, whose personal attack on Robart, decrying his opinion as “ridiculous,” went too far for some who said the president was undermining an institution designed to check the power of the White House and Congress, said he was confident the government would prevail.

“We’ll win. For the safety of the country, we’ll win,” he told reporters in Florida.

Robart’s ruling came in a case brought by the state attorney general of Washington state and was backed by major state employers Amazon.com Inc and Expedia Inc.. The lawsuit is one of several now filed against the Trump executive order around the United States, but it was the first case leading to a broad decision that applies nationwide.

The Justice Department appeal criticized Robart’s legal reasoning, saying it violates the separation of powers and steps on the president’s authority as commander chief.

The appeal said the state of Washington lacked standing to challenge the order and denied that the order “favors Christians at the expense of Muslims.”

Slideshow ( 4 images )

Congress gave the president “the unreviewable authority to suspend the admission of any class” of visitor, the Justice Department wrote.

“Courts are particularly ill-equipped to second-guess the president’s prospective judgment about future risks,” the appeal said, calling the decision “vastly overbroad.”

Washington state lawyers worked around the clock last weekend against the backdrop of turbulent scenes at U.S. airports, where immigrants were detained by federal officials unprepared to implement the president’s directive.

A spokesman for Washington state attorney general Bob Ferguson didn’t immediately comment early Sunday.

The U.S. State Department and Department of Homeland Security said they were complying with Robart’s order and many visitors are expected to start arriving on Sunday, while the government said it expects to begin admitting refugees again on Monday.

A decision to reinstate Trump’s order could again cause havoc at U.S. airports because some visitors are in transit, as was the case when the order took effect on Jan. 27.

As the ban lifted Friday, refugees and thousands of travelers from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen who had been stopped in their tracks last weekend by the executive order scrambled to get flights to quickly enter the United States.

The panel that will decide whether to immediately block the ruling includes three judges appointed by former Republican president George W. Bush and two former Democratic presidents, Jimmy Carter and Barack Obama.

U.S. immigration advocacy groups including the American Civil Liberties Union on Saturday in a joint statement urged those with now valid visas from the seven nations “to consider rebooking travel to the United States immediately” because the ruling could be overturned or put on hold.

A U.S. State Department email reviewed by Reuters said the department is working to begin admitting refugees including Syrians as soon as Monday.

Trump’s Jan. 27 order had barred admission of citizens from seven majority Muslim nations for 90 days, suspended all refugee admissions for 120 days and indefinitely barred Syrian refugees.

SEPARATION OF POWERS

It is unusual for a president to attack a member of the judiciary, which the U.S. Constitution designates as a check to the power of the executive branch and Congress.

Reached by email Saturday, Robart declined comment on Trump’s tweets.

Democratic U.S. Senator Patrick Leahy of Vermont said in a statement Saturday that Trump’s “hostility toward the rule of law is not just embarrassing, it is dangerous. He seems intent on precipitating a constitutional crisis.”

In an interview with ABC scheduled to air Sunday, Vice President Mike Pence said he did not think that Trump’s criticisms of the judge undermined the separation of powers.

The court ruling was the first move in what could be months of legal challenges to Trump’s push to clamp down on immigration.

The sudden reversal of the ban catapulted would-be immigrants back to airports, with uncertainty over how long the window to enter the United States will remain open.

In Erbil, the capital of the Kurdish region of northern Iraq, Fuad Sharef and his family prepared to fly on Saturday to Istanbul and then New York before starting a new life in Nashville, Tennessee.

Virtually all refugees also were barred by Trump’s order, upending the lives of thousands of people who have spent years seeking asylum in the United States.