Fresh challenges to President Trump’s court-frozen immigration order took shape Monday with two former secretaries of state claiming the White House was undermining national security and nearly 100 Silicon Valley tech companies arguing it will keep the best minds from coming to America.

The powerful new voices were added with another legal showdown coming as early as Monday. The suspension of the order, meanwhile, has allowed those previously banned more time to try to reach the United States.

“I can’t believe it. I am so happy,” said Anab Ali moments after her nephew, Mustafa Aidid, walked through the arrivals gate at Dulles International Airport on Monday — five days after the 22-year-old Somali was blocked from boarding a flight in Dubai despite a U.S. visa.

[Who could be affected by the travel ban]

A decision Sunday by the U.S. Court of Appeals for the 9th Circuit preserved a lower judge’s order to temporarily halt the ban — and based on a schedule the court outlined, the stop will remain in place at least until sometime on Monday. The Justice Department said it would not elevate the dispute to the Supreme Court before that.

(Bastien Inzaurralde/The Washington Post)

Trump responded to the development Sunday by writing on Twitter that he had “instructed Homeland Security to check people coming into our country VERY CAREFULLY.” A Department of Homeland Security spokeswoman did not immediately return messages seeking comment on how, practically, that screening would be implemented.

“Just cannot believe a judge would put our country in such peril,” Trump wrote. “If something happens blame him and court system. People pouring in. Bad!”

Trump further came to the defense of his stalled order Monday. In a tweet, Trump dismissed as “fake news” various polls showing opposition to the executive order. “Sorry,” Trump wrote, “people want border security and extreme vetting.”

[The order denying the Trump administration’s request to restore the travel ban]

The next few days will be telling for the future of the president’s executive order. The states of Washington and Minnesota, which are challenging the ban, asked the appeals court in the wee hours of Monday to keep the ban suspended, and Justice Department lawyers have until 6 p.m. to respond. The court will then schedule a hearing or rule whether the ban should remain on hold.

Early Monday, two former secretaries of state — John F. Kerry and Madeline Albright — joined a six-page joint statement saying Trump’s order “undermines” national security and will “endanger U.S. troops in the field.” The rare declaration, addressed to the 9th Circuit, was also backed by top former national security officials including Leon Panetta, who served as a past CIA director and defense secretary during the Obama administration.

[Court document: Declaration of National Security Officials]

1 of 25 Full Screen Autoplay Close Skip Ad × Travelers affected by ban begin to arrive in U.S. after Trump order is suspended View Photos After a federal judge in Seattle temporarily blocked enforcement of President Trump’s travel ban, government authorities immediately told airlines to allow travel by those who had been barred, a U.S. official said. Caption After a federal judge in Seattle temporarily blocked enforcement of President Trump’s travel ban, government authorities immediately told airlines to allow travel by those who had been barred, a U.S. official said. Feb. 6, 2017 Muhamad Alhaj Moustafa, an internal medicine resident at MedStar Washington Hospital Center, embraces his wife, Nabila Alhaffar, after her arrival at Dulles International Airport. She had been temporarily blocked from returning to the United States after a trip to Qatar to see family. Melina Mara/The Washington Post Buy Photo Wait 1 second to continue.

Hours earlier, a host of technology giants — including Apple, Facebook, Google, Microsoft, Netflix, Twitter, Uber — were part of a “friend of the court” legal brief by 97 companies opposing the Trump administration’s immigration order.

The brief claimed the order was a “significant departure” from U.S. immigration policies and “makes it more difficult and expensive for U.S. companies to recruit, hire, and retain some of the world’s best employees.”

[Court document: Amicus brief by tech companies]

In the meantime, people who had been stranded in legal limbo rushed to fly back to the United States. Some successfully reunited with family members, while others — particularly those whose visas were physically taken or marked as invalid — ran into roadblocks trying to board planes overseas.

At Dulles on Sunday, immigration lawyers could be heard on phones, arguing with airline representatives to let their passengers board as some seemed confused over the various court rulings and what they meant.

On Monday, the Somali traveler Aidid was elated once he heard the entry stamp hitting his passport. Aidid, who lives in the United Arab Emirates, had a temporary visa so he and his childhood sweetheart could get married in the United States.

“I didn’t know what to do. We had waited so long,” he said, referring to the two-year process for the visa.

He said he did not sleep the entire 15-hour flight from Dubai. From Dulles, Aidid headed to his aunt’s home in Asburn to get some rest.

What lies ahead is likely to be a weeks-long battle that will be waged in courtrooms across the country over whether Trump’s ban can pass legal muster. Federal courts in New York, California and elsewhere have blocked aspects of the ban from being implemented, although one federal judge in Massachusetts said he did not think that challengers had demonstrated that they had a high likelihood of success. The lawsuits now stretch from D.C. to Hawaii, and the number seems to grow regularly.

The Trump administration has been steadfast in its support of the executive order, which it says is necessary for national security, and the president himself tweeted repeatedly his disdain for the judge in Washington state who put a stop to it.

“The opinion of this so-called judge, which essentially takes law-enforcement away from our country, is ridiculous and will be overturned!” Trump wrote Saturday.

[Trump lashes out at ‘so-called judge’ who temporarily blocked entry ban]

Vice President Pence said Sunday on NBC’s “Meet The Press” that White House officials felt that Trump was “operating within his authority as president, both under the Constitution and under clear statutory law.” Legal analysts have said the president has broad authority to set immigration policy, although civil liberties advocates have countered that the order essentially amounts to a discriminatory ban on Muslims that has no real national security purpose.

“We’re very confident that we’re going to prevail,” Pence said. “We’ll accomplish the stay and will win the case on the merits. But again, the focus here is on the safety and security of the American people.”

On Sunday morning television talk shows, some Republicans in Congress took issue with comments by the president, particularly his description of U.S. District Judge James L. Robart as a “so-called judge.”

“I’ll be honest, I don’t understand language like that,” Sen. Ben Sasse (R-Neb.) said. “We don’t have so-called judges, we don’t have so-called senators, we don’t have so-called presidents. We have people from three different branches of government who take an oath to uphold and defend the Constitution. . . . So, we don’t have any so-called judges, we have real judges.”

Senate Majority Leader Mitch McConnell (R-Ky.) said: “We all get disappointed from time to time at the outcome in courts on things that we care about. But I think it is best to avoid criticizing judges individually.”

McConnell went on to offer a broader critique of Trump’s executive order than he had previously: “We all want to try to keep terrorists out of the United States. But we can’t shut down travel. We certainly don’t want Muslim allies who have fought with us in countries overseas to not be able to travel to the United States. We need to be careful about this.”

Several federal judges have ruled against the administration on its implementation of the ban, though the case now before the San Francisco-based 9th Circuit is perhaps the most significant one. It stems from a lawsuit brought by the states of Washington and Minnesota, which alleged that the immigration order was “separating families, harming thousands of the States’ residents, damaging the States’ economies, hurting State-based companies, and undermining both States’ sovereign interest in remaining a welcoming place for immigrants and refugees.”

Responding to those arguments, Robart temporarily halted the ban on Friday. Then, 9th Circuit Judges William C. Canby Jr., who was appointed by President Jimmy Carter, and Michelle Taryn Friedland, who was appointed by President Barack Obama, denied the Justice Department’s request on Sunday to immediately restore it.

[Travelers from Iran board flights to the United States following stay, attorney says]

The Justice Department could have gone straight to the Supreme Court, but a Justice Department spokesman said it would not do so.

“With the fast briefing schedule the appeals court laid out, we do not plan to ask the Supreme Court for an immediate stay but instead let the appeals process play out,” spokesman Peter Carr said.

Although the side that loses can request intervention from the nation’s highest judicial body, it would take the votes of five justices to overturn the panel’s decision. The court has been shorthanded since the death of Justice Antonin Scalia nearly a year ago, and it is ideologically divided between four more liberal justices and four conservative-leaning ones.

Leon Fresco, deputy assistant attorney general for the Office of Immigration Litigation in Obama’s Justice Department, said he was “surprised that there is this exuberance to immediately rescind the executive order,” particularly given the timing issues.

Trump’s order, which barred all refugees as well as citizens of seven Muslim-majority countries from traveling to the United States, was temporary. Refugees were banned for 120 days. The others were barred for 90 days, except those from Syria, whose travel to the United States was blocked indefinitely. The order was purportedly designed to give the administration time to formulate a plan on how to vet people coming from countries that have terrorist activity.

“It is perplexing why the government wouldn’t want to simply, at this point, maintain an orderly process in one court as opposed to fighting it out all across the country in different courts, and working its way to the Supreme Court,” Fresco said. “Unless the goal is to have an outright travel ban forever, and we should take the president at his word that that’s not the goal, then let’s just have calmer heads prevail and conduct the security analysis that was going to be conducted during these 90 days.”

Indeed, if Trump’s ban were to be immediately reinstated, that might spark chaos similar to what occurred when it was first rolled out on Jan. 27. To implement the order then, the State Department provisionally revoked tens of thousands of visas. When people began landing at U.S. airports, Customs and Border Protection officers detained more than 100 people and deported some, sparking protests and lawsuits across the country.

It was unclear Sunday whether U.S. officials had a plan in place to avoid a repeat of that scenario, though much would depend on what specifically was ordered by a court, and when. Spokesmen for the State Department and Customs and Border Protection declined to comment on the question.

In an interview with Bill O’Reilly of Fox News that aired Sunday afternoon, Trump insisted that the initial implementation of his order was “very smooth” and said — misleadingly — that “you had 109 people out of hundreds of thousands of travelers, and all we did was vet those people very, very carefully.” That does not take into account the tens of thousands of people who could not travel because their visa was revoked; nor does it acknowledge those who were taken out of the country after their plane landed.

The Department of Homeland Security said Saturday that because of Robart’s ruling, it was suspending enforcement of the executive order entirely, and the State Department restored the visas that had been provisionally revoked. Advocates encouraged travelers from the affected countries who qualified for entry to get on planes as soon as possible because of the unpredictable legal terrain.

Early Sunday, the Justice Department asked the appeals court to intervene, asserting that it was improper for a lower court to engage in “second-guessing” of the president’s judgment on a national security matter.

[The Justice Department’s argument to restore the travel ban]

“The injunction contravenes the constitutional separation of powers; harms the public by thwarting enforcement of an Executive Order issued by the nation’s elected representative responsible for immigration matters and foreign affairs; and ­second-guesses the President’s national security judgment about the quantum of risk posed by the admission of certain classes of aliens and the best means of minimizing that risk,” acting solicitor general Noel Francisco wrote in a brief.

It is somewhat unusual for a district judge to issue an order that affects the entire country, but Robart, who was nominated by President George W. Bush and has been on the bench since 2004, said it was necessary to follow Congress’s intention that “the immigration laws of the United States should be enforced vigorously and uniformly.”

He was quoting from a 2015 appeals court ruling that had blocked Obama’s executive action that would have made it easier for undocumented immigrants to remain in the United States. It was never implemented because of legal challenges.

Antonio Olivo, Fred Barbash, Darryl Fears, Mike DeBonis, Spencer S. Hsu, Aaron Blake, Fenit Nirappil and Mark Guarino contributed to this report.