In early September, the State Department gave exciting news to tens of thousands of highly skilled legal immigrants in the United States who had been stuck for years in visa backlogs, waiting for green cards. On Oct. 1, they would take a big step forward along the path to their documents, a department bulletin said.

Then, just as suddenly and with no explanation, the department reversed course Sept. 25, sending most of the immigrants — including many people from India and China with advanced degrees and professional careers in the United States — back to where they had been in slow-moving visa lines, dashing their hopes and disrupting their lives.

The problem was that immigration officials realized belatedly that they did not have enough green card visas, which are limited by yearly quotas, for all the immigrants they had allowed to apply for them, Obama administration officials said.

“It was a devastating blow for the workers and their families with skills we are trying to retain in the United States,” said Lynden Melmed, a lawyer at Berry, Appleman & Leiden in Washington, who was formerly general counsel of the Department of Homeland Security agency that administers immigration with the State Department. Immigrants who were affected filed a federal lawsuit in Seattle, accusing the administration of “arbitrary and capricious action” that cost them millions of dollars.