Most Iranians cannot obtain visas to travel to the United States because of the travel ban on visitors from their country, as well as from Libya, Somalia, Syria, Yemen, North Korea and Venezuela. But there are narrow exemptions, including for students. Most of the students who were barred had been given single-entry visas, and were prepared to go years without seeing family members who would not have been able to visit them.

In phone interviews and emails, the students said they were crestfallen. Some had left high-level jobs or sold their homes, or had turned down opportunities in Europe or Canada. Most said their studies had been fully funded , and many had been slated to begin teaching or research positions in addition to their studies.

“I feel I’m damaged emotionally, financially, academically,” said Peyman, 23, who was supposed to begin a degree in electrical engineering at the University of California at San Diego. He asked to be identified only by his first name because he did not want to jeopardize his chances of getting another visa.

Peyman said that he had been barred from a connecting flight in Qatar this month and that an airline employee had scrawled “ CANCELLED ” across his visa in pen, saying the instructions to do so had come from the Department of Homeland Security.

The State Department does not release data on visa revocations, and the d epartment said it could not release information about individual cases.

Mr. Abdi, the president of the National Iranian American Council, said the group normally hears about visa denials, not last-minute revocations . But new vetting procedures — including reviewing social media information from visa applicants — have been “a black box,” he said.

The student workers in the University of California system are represented by the United Automobile Workers Local 2865. Its president, Kavitha Iyengar, said in a statement that her members “do not deserve to be discriminated against.”