WASHINGTON (AP) — The Justice Department has appealed a judge's order temporarily blocking President Donald Trump's refugee and immigration ban, saying it's the "sovereign prerogative" of a president to admit or exclude aliens in order to protect national security.

The appeal filed late Saturday at the 9th U.S. Circuit Court of Appeals in San Francisco, cites a "basic principle that an alien seeking initial admission to the United States requests a privilege and has no constitutional rights regarding his application."

The Justice Department asked that the federal judge's order be stayed pending resolution of the appeal. It says the ban is necessary "to ensure that those approved for admission do not intend to harm Americans and that they have no ties to terrorism."

Earlier Saturday, the government officially suspended enforcement of the ban in compliance with the judge's order, which plunged the new administration into a crisis that has challenged both Trump's authority and his ability to fulfill campaign promises.

That stand-down marked an extraordinary setback for the White House. Only a week ago, the president had acted to suspend America's refugee program and halt immigration to the U.S. from seven Muslim-majority countries that the government said raise terrorism concerns.

The appeal says the temporary restraining order by U.S. District Judge James Robart in Seattle is a broad overreach of judicial authority.

"Judicial second-guessing of the President's national security determination in itself imposes substantial harm on the federal government and the nation at large," it says. The order also imposes harm on U.S. citizens "by thwarting the legal effect of the public's chosen representative," it says.

On Twitter, Trump mocked Robart, appointed by President George W. Bush, as a "so-called judge" whose "ridiculous" ruling "will be overturned." He added in a subsequent tweet: "Because the ban was lifted by a judge, many very bad and dangerous people may be pouring into our country. A terrible decision."

Story continues

Trump's direct attack recalled his diatribes during the campaign against a federal judge of Mexican heritage who was overseeing a Trump University case. Justice Department lawyers could be called upon to answer for his words as the travel ban case is judged by higher courts.

The ban has caused unending confusion for many foreigners trying to reach the United States, prompting protests across the United States and leading to multiple court challenges. Demonstrations took place outside the White House, in New York and near Trump's estate in Palm Beach, Florida, where he was spending the weekend and attending an annual American Red Cross fundraising gala.

"We'll win," Trump told reporters Saturday night. "For the safety of the country, we'll win."

The State Department, after initially saying that as many as 60,000 foreigners from Iraq, Syria, Iran, Sudan, Libya, Somalia or Yemen had their visas canceled, reversed course on Saturday and said they could travel to the U.S. if they had a valid visa.

The department on Saturday advised refugee aid agencies that refugees set to travel before Trump signed his order will now be allowed into the United States. A State Department official said in an email obtained by The Associated Press that the government was "focusing on booking refugee travel" through Feb. 17 and working to have arrivals resume as soon as Monday.

The Homeland Security Department no longer was directing airlines to prevent visa-holders affected by Trump's order from boarding U.S.-bound planes. The agency said it had "suspended any and all actions" related to putting in place Trump's order, which the White House argued was "intended to protect the homeland."

Trump made clear what he thought of Robart's action.

"The opinion of this so-called judge, which essentially takes law-enforcement away from our country, is ridiculous and will be overturned," Trump tweeted. "When a country is no longer able to say who can and who cannot come in & out, especially for reasons of safety & security - big trouble!"

After a pause of several hours, the president returned to Twitter: "What is our country coming to when a judge can halt a Homeland Security travel ban and anyone, even with bad intentions, can come into U.S.?"

Sen. Patrick Leahy, D-Vt., a member of the Senate Judiciary Committee, criticized Trump for "attempting to bully and disparage yet another federal judge" and said he seemed "intent on precipitating a constitutional crisis."

Trump's rhetoric also could put government lawyers defending his order in a tough spot.

"Either they have to defend the statements that Judge Robart is a 'so-called judge,' which you can't do, or they have to distance themselves from the president, who is their boss," said University of Pittsburgh law professor Arthur Hellman.

With legal challenges pending, two prominent Middle Eastern air carriers announced they would resume carrying passengers from the seven affected countries. Qatar Airways and Etihad Airways, national carrier of the United Arab Emirates, said U.S.-bound travelers from those countries with valid visas would be allowed to board.

In Egypt, Cairo airport and airline officials said they have received instructions from the U.S. Customs and Border Protection to suspend President Trump's executive order.

Government-backed Qatar Airways is one of a few Mideast airlines operating direct daily flights to multiple American cities. Its U.S. destinations from its Doha hub include New York, Chicago, Los Angeles, Miami and Washington.

At New York's John F. Kennedy International Airport, volunteer lawyer Renee Paradis said most of the flights involving passengers from the affected countries were to arrive later Saturday.

"Anybody who comes here on a visa is supposed to be allowed in, so we would anticipate that somebody who is in the air would be able to land and enter," she said. "Of course, as with everything this week, it remains to be seen what happens on the ground."

The executive order has caused chaos within the government and the courts. Trump fired Sally Yates, an Obama administration holdover who was serving as acting attorney general, after she said the Justice Department would not enforce it. In Washington on Saturday, demonstrators chanting "No hate, No fear, Refugees are welcome here" walked from the White House down Pennsylvania Avenue.

Hearings have also been held in court challenges nationwide.

In arguments to the court, Washington state and Minnesota said the temporary ban and the global suspension of the U.S. refugee program harmed residents and effectively mandated discrimination.

Federal attorneys had argued that Congress gave the president authority to make decisions on national security and immigrant entry.

But in his written order Friday, Robart said it's not the court's job to "create policy or judge the wisdom of any particular policy promoted by the other two branches," but rather, to make sure that an action taken by the government "comports with our country's laws."

___

Associated Press writers Alicia A. Caldwell, Mark Sherman, Matthew Lee and Jessica Gresko in Washington, Martha Bellisle in Seattle, William Mathis and Julie Walker in New York, Susannah George in Baghdad, Hamza Hendawi in Cairo and Adam Schreck in Dubai, United Arab Emirates contributed to this report.