The students, who were mostly headed to schools in the University of California system, had visas in hand when they were blocked from their flights this month.
At least a dozen Iranian students who were set to begin graduate programs in engineering and computer science say their visas were abruptly canceled and they were barred from their flights to the United States this month.
The sudden batch of visa cancellations, which came at a time of heightened tensions between the United States and Iran, set off a scramble by university officials, lawmakers, the students’ union and Iranian-American advocates to figure out what had happened.
The State Department said that there had been no change in policy regarding student visas, and higher education officials say that visa problems arise every fall for some of the hundreds of thousands of international students who travel to attend American colleges and universities.
But the students, most of whom were headed to schools in the University of California system, say their visas were revoked at the last minute, without any warning or explanation. Most were prevented from boarding flights in Iran, and others from boarding connecting flights in the Persian Gulf. One was detained at Boston Logan International Airport and then turned back.
Many of the students said that a State Department webpage showed their visa cases had been updated around Aug. 30, and they were prevented from boarding in early September. All of that came before a Sept. 14 attack on two key Saudi oil installations, which has escalated a standoff between the United States and its ally Saudi Arabia against Iran. [President Trump announced a new round of sanctions against Iran on Friday.]
A law enacted in 2012 under President Barack Obama requires the United States government to deny visas to Iranian students whose coursework would prepare them to work in the energy or nuclear sectors in their home country. Consular officials have wide discretion on how to interpret the statute and put it in place, said Jamal Abdi, the president of the National Iranian American Council, a Washington-based group.
Mark Dubowitz, the chief executive of the Foundation for Defense of Democracies, also based in Washington, said he appreciated that the 2012 law had sought to prevent knowledge gained in the United States from being used in the service of the Iranian government.
But he pointed to the difficulty in predicting how students would use technical skills that are widely sought after and applicable in many industries. He suggested a more radical approach: to overturn the Trump administration’s travel ban and require Iranian students in sensitive fields to stay in the United States after graduation.
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 department 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.”
She said that the union often helps members who have visa issues, but that she had never seen a problem of this scope.
John A. Pérez, the chairman of the University of California system’s Board of Regents, said the university would stand with its international students “no matter where they were born — and protect them in any way we can from the unpredictable actions of this administration.”
The university’s media relations office said in a separate statement that it was working with government agencies and lawmakers to resolve the issue. It also noted that other Iranian students in the science, technology, engineering and math fields had arrived on campus before September.
A spokesman for Customs and Border Protection reiterated that there had been no change in policy. He added that the agency had the authority to cancel visas but also had policies in place “to ensure multiple layers of review when adjudicating a denial of admission.”
The White House did not immediately respond to a question about whether visa policy had been changed.
At a time when the Iranian economy is in dire condition, hobbled by American sanctions, many Iranian students pay out of pocket to visit the American embassies in Armenia or Turkey for visa interviews, in addition to paying for plane tickets and other arrangements.
Nima Abdollahpour, 23, completed his bachelor’s degree at Sharif University of Technology in Tehran, which is often called the M.I.T. of Iran, and had planned to study electrical and computer engineering at the University of California, Davis.
He said he and other students had grown frustrated as they were directed from one government agency to the next.
“I am a student who will lose another year or two of my life to find another program, as well as tons of money and energy,” he said.
Mr. Abdollahpour’s account was published in The Davis Enterprise, a California newspaper, earlier this week. Chinese scholars have also faced restrictions on visas to the United States amid tensions between the two countries, prompting educators to voice concerns about the possible impact on innovation and on researchers already in the United States. Last month, nine Chinese undergraduate students enrolled at Arizona State University were detained at Los Angeles International Airport and sent back to China without explanation.
In a statement on Thursday, Michael M. Crow, the president of Arizona State University, criticized Customs and Border Protection’s handling of the student visa process.
“They are unevenly and inappropriately making determinations that have no factual basis and that they have no experience making,” he said.
“If C.B.P. and D.H.S. do not take this problem seriously,” Mr. Crow said, “all universities need to seek review by Congress and the courts.”