Baraa Haj Khalaf holds an American flag as she walks to the parking lot at O'Hare International Airport in Chicago on Feb. 7. Her family, Syrian refugees, had been told they couldn't fly to Chicago because of President Trump's executive order, but that order was suspended. (Nuccio Dinuzzo/AP)

Syrian refugees across the Middle East have felt something akin to legal whiplash these past few weeks. As news broke Friday that the suspension of President Trump’s immigration ban had been sustained by a federal appeals court, that sensation was melting into one of relief.

Trump’s Jan. 27 order, which temporarily barred travelers from seven Muslim-majority countries and all refugees, had blindsided thousands of Syrians expecting imminent resettlement in the United States.

For many families, the weeks that followed have felt like a crash course in the U.S. political and judicial systems as they navigate the hopes and heartache of a legal drama with far-reaching human consequences.

[Appeals court rules 3 to 0 against Trump on travel ban]

“We were relieved that the first judge said no to Trump’s decision, but then we watched our futures go through court after court. That wasn’t easy to understand,” said Wafaa Mohamed, 34, whose family had been in the final stages of U.S. security vetting when news of the ban broke.

(Claritza Jimenez,Dani Player/The Washington Post)

Originally from one of the first Damascus suburbs to rise up against Syrian President Bashar al-Assad, Mohamed fled to Jordan in 2012, after fearing her daughters would be detained on the walk to school.

“Today, I am hopeful for them,” said the mother of three.

“These weeks have been hard, but we want to live in a country that has democracy and the rule of law,” she said. “This ruling proves that America has all of those things.”

Two weeks ago, Trump signed an executive order barring refugees from entering the United States for 120 days and indefinitely suspended an Obama administration program for the resettlement of Syrians fleeing war. The order also temporarily suspended all U.S. entry for citizens from seven nations: Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen.

[Who would be affected by the Trump travel ban and how]

A weekend of chaos followed across U.S. airports, with nationals of the blacklisted countries, including those with green cards, being held for questioning while relatives and protesters gathered in arrival halls.

The ban was suspended last week by a federal judge in Seattle. And late Thursday, three judges from the U.S. Court of Appeals for the 9th Circuit rejected the government’s argument that an earlier suspension of the executive order should be lifted immediately for national security reasons.

“The Government has pointed to no evidence that any alien from any of the countries named in the Order has perpetrated a terrorist attack in the United States,” the appeals court judges said in the 29-page decision.

The International Rescue Committee (IRC), which supports refu­gee arrivals across the United States, said it now expects to welcome about 350 new arrivals in the coming week, nearly a quarter of them Syrian. Others will be hosted by smaller agencies and faith groups.

“The confusion and chaos that resulted from the administration’s hasty and harmful executive order should be a lesson to keep intact carefully developed procedures that have kept America safe,” said David Miliband, IRC’s president and chief executive.

Although a blow to government ambitions, the ruling is unlikely to be decisive and the case is now expected to be settled by the Supreme Court. And Trump’s dogged attempts to reinstate the ban have left some fearful at the welcome they might receive in the United States, assuming they make it at all.

Waiting in Cairo for news of her family’s resettlement, Lamis al-Hamawi, 40, said she was scared of how “the authorities” might treat them.

The Hamawis will touch down in the United States with little. Their escape from Syria felt so urgent that they carried few possessions. Cairo has also proved an unforgiving city for a young refu­gee family. Amid the saturated jobs market and routine discrimination against Syrians, they struggle to put food on the table.

Thursday’s ruling also provided a welcome boost to some Syrian nationals for whom the executive order had trampled the hopes of further academic study.

Two weeks after learning his visa interview had been canceled, Alaa Alsabeh, 23, was back on a plane to Cyprus from Syria early Friday, after learning his travel papers had been reinstated.

The engineering student had been told Trump’s executive order would prevent him from attending Michigan’s Wayne State University.

“It happened so fast that I haven’t had time to process this yet,” he said. “I think this will be good for me.”

But others would be going elsewhere. Days after the executive order was signed, Germany offered three men grants to continue their research at universities in the state of Baden-Wuerttemberg.

A spokesman for the local science ministry confirmed Friday that one Syrian and two Iranian researchers were expected to arrive in about two weeks, emphasizing the country’s willingness to attract talented researchers from all over the world, regardless of their country of origin.

Zakaria Zakaria in Istanbul, Heba Farouk Mahfouz in Cairo and Rick Noak in London contributed to this report.

Read more:

Federal appeals court rules 3 to 0 against Trump on travel ban

7 key take-aways from the court’s ruling on Trump’s immigration order

A Syrian family waited through the night as judges debated Trump travel ban

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news