Harvard medical researcher Soumya Raychaudhuri pauses during an interview at Brigham and Women’s Hospital in Boston on Tuesday. Raychaudhuri awaits the fate of a new hire, Samira Asgari, an Iranian national and researcher who was prevented from boarding a flight in Frankfurt. (Steven Senne/AP)

One by one, they were blocked from entering the United States: a scientist barred from a flight, two engineers detained in Boston, and a doctoral student put back on a plane at John F. Kennedy Airport in New York.

The travelers were all Iranian nationals holding permanent U.S. residency or valid work or student visas, and their lives were disrupted when President Trump signed an executive order last week temporarily banning nationals from seven Muslim-majority countries from entering the United States.

It was unclear how many people were affected by the ban, but hundreds of Iranians included under it reported facing difficulties at U.S. borders or airports around the globe, according to a crowdsourced database tracking the effects of the new order.

Some — including Nazanin Zinouri, a data scientist stopped by U.S. border agents in Dubai — had lived in the United States for years. Others — such as genomics researcher Samira Asgari, who was prevented from boarding a flight in Frankfurt — were about to start new jobs or other new opportunities.

[Denied Entry: Stories of refugees and immigrants barred from the U.S.]

In this undated photo provided by Nazanin Zinouri, she poses for a photo with her PhD degree from Clemson. Zinouri, who has a visa and has lived in the United States since August 2010, flew to Iran on Jan. 20, expecting to have three weeks of time with her family. Instead, she was barely in Tehran before she began trying to get home to South Carolina after President Trump’s order barring entry to people from Iran and six other majority-Muslim countries. (Parastoo Amiri/AP)

A State Department cable sent by the U.S. consulate in Dubai said the interviews of more than 50 Iranian visa applicants were cancelled on Jan. 30 alone.

The cable, which was sent to The Washington Post by a U.S. diplomat in the region, said consulate staff “witnessed significant frustration and confusion” among the Iranians who had traveled for the appointments. The diplomat requested anonymity because the cable was internal and not meant for release.

But the circumstances of people such as Zinouri and Asgari, who filed a lawsuit against the U.S. government on Wednesday in federal court, also shed light on the larger community of Iranian professionals living and working in the United States.

The flow of Iranian scientists and scholars to U.S. universities and research institutions has persisted for decades, despite fraught relations between the two countries. More than 12,000 Iranians were in the United States on student and scholar visas last November, according to the latest data from the Department of Homeland Security. Iran’s own cabinet is packed with U.S.-educated officials, including the Iranian foreign minister, Mohammad Javad Zarif.

Trump’s order has already deprived U.S. companies and universities of accomplished students and employees, and threatens to eliminate one of the few areas of cooperation that has survived decades of U.S.-Iranian tensions and harsh economic sanctions.

Asgari, the researcher, had won a postdoctoral fellowship at the Boston-area Brigham and Women’s Hospital, where she would focus on tuberculosis. Zinouri had just started a job at Modjoul, a tech start-up in South Carolina, which called her a “valued colleague” after she was prevented from entering the United States.

“Despite the past decade of sanctions [against Iran], and the lack of U.S. consular representation in Iran, Iranian students have still sought out U.S. education,” said Steven Ditto, the author of a report on Iranian students in the United States for the Washington Institute for Near East Policy.

Even as Congress was ramping up sanctions on Iran over terrorism concerns, the State Department under former president Barack Obama launched Persian-language websites to guide Iranian students through the university application process. Iran’s higher-education system generally has poor standards, Ditto said, prompting Iranian students to look to the United States for a more quality education.

“Iranian students have been here for nearly a century . . . there are deep and abiding connections that reveal themselves when you look at the historical record,” he said. “They want to improve their lives . . . to seek a better future and fulfill their academic potential.”

And “many do successfully stay in the U.S.,” he said.

[Trump’s immigration order will be tough to overturn, legal analysts say]

In many ways, the situation mirrors the dark days following the Iranian hostage crisis, when revolutionary students seized the U.S. Embassy in Tehran and detained American diplomats in 1979.

The U.S. government responded to that crisis by revoking the visas of all Iranian non-immigrants, and suspending visas for all Iranian citizens. More than 56,000 Iranian students reported to immigration officials, according to the Public Affairs Alliance of Iranian Americans, an Iranian-American advocacy group. A number of those students were deported, the group says.

Since the travel restrictions went into effect last Friday, more than 300 Iranians have reported difficulties when trying to enter the United States, according to the crowdsourced database, which was created by Hazhir Rahmandad, an Iranian American professor at the Massachusetts Institute of Technology.

Then a ballistic missile test by Iran further outraged the White House. Such launches are not in violation of U.N. resolutions unless the missiles are designed for nuclear payloads — which Iran claims they are not.

“Iran is playing with fire - they don’t appreciate how “kind” President Obama was to them. Not me!” Trump tweeted early Friday.

“I do not feel as safe as I did under the Obama administration,” said Ali Abdi, an Iranian-born doctoral candidate at Yale University. Abdi, who came to the United States as a refugee and is a permanent, legal resident, was in Dubai when the ban went into effect. He is conducting field research in Afghanistan and is still unsure if he can return to the United States.

“I don’t know where to call home anymore,” he said. “I’m now sitting at a hotel in Dubai.”

Another Iranian doctoral student, Vahideh Rasekhi, was also in limbo last Saturday night, when U.S. border agents detained her for more than 16 hours on arrival at New York’s JFK Airport. Rasekhi, who is completing her doctorate in linguistics at Stony Brook University, was at one point put on a plane headed to the Ukrainian capital, Kiev. She was removed at the last minute, according to volunteer immigration lawyers and local media reports, after a federal judge issued an order halting deportations.

[Judge halts deportations as refugee ban causes worldwide furor]

Elsewhere, at Boston’s Logan International Airport, immigration officials detained Mazdak Tootkaboni and Arghavan Louhghalam — both Iranian green-card holders and professors at the University of Massachusetts at Dartmouth — until another federal injunction came through.

“This is not the country we promised to them when we invited them to study, teach, and conduct research here,” the university’s president, Marty Meehan, said in a statement condemning the order.

Of the 12,400 Iranians on student or scholar visas in the United States, more than 11,000 are studying or conducting research at the postgraduate level.

In 2015, DHS reported 2,250 Iranians as having obtained legal, permanent residence for employment purposes. More than 13,000 Iranians obtained green cards in 2015, according to DHS.

Read more:

Gold Star father Khizr Khan: Congress, voters should resist ‘Muslim ban’

Today’s coverage from Post correspondents around the world

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