A federal judge on Thursday dismissed a class-action lawsuit filed by a Dublin man and 35 other people who were told they won a chance to get a U.S. green card, only to be informed that the State Department voided the results of its annual visa lottery because of a computer glitch.

U.S. District Judge Amy Berman Jackson said she sympathized with the plaintiffs and thousands of others who thought they had been selected for one of 50,000 diversity visas, which are awarded randomly each year to people from countries with low rates of emigration to the U.S.

Jackson, however, sided with the State Department in arguing that the results had to be voided because a computer problem had caused the selection to favor certain applicants over others. The process is supposed to be strictly random.

The emotional impact of the State Department's reversal "has been painful and real," Jackson wrote in a 34-page ruling for the U.S. District Court in Washington, D.C., but "there are 19 million more stories, from other lottery participants, many of which may be equally or even more compelling, and it is for that reason that Congress determined that every applicant would have an equal chance of winning the right to apply for the visa."

Of the 19 million people around the world who entered the lottery, the plaintiffs were among 22,316 who received a message from the State Department in early May that they had been randomly selected to apply for a green card. The State Department later explained that computer problems skewed the results, causing them to not be truly random.

The government voided the results and promised a redraw this summer. The results of the second lottery attempt are scheduled to be released Friday.

The plaintiffs argued that while the original results, which favored people who applied on the first two days of the submission period, were unusual, they should still be considered random because no one knew which dates were more favorable when they applied. Jackson dismissed that argument.

"Plaintiffs' attempts to characterize the results of the flawed process as random make a hash of the statute and defy common sense," she wrote.

Among the plaintiffs was 28-year-old software engineer Anton Kuraev, a Dublin resident from Russia who has been living in the Bay Area on a temporary work visa but wants to stay here permanently. Kuraev said that he believes Jackson's ruling makes sense but he remains angered that the State Department made such a big mistake affecting thousands of lives.

"I completely disagree with the fact that none of those who contributed to this mess is penalized," Kuraev wrote in an email. "What they did is a shame."

He spent hundreds of dollars to file the necessary paperwork.

"I wish one day this lottery program will be terminated and all its visa pool will be distributed in a more reasonable manner," Kuraev said.

Another would-be immigrant who was told he was a winner, 24-year-old French online entrepreneur Tarik Ansari, said he was disappointed by the ruling but will be checking the State Department website early on Friday morning hoping he gets selected again.

Because there are millions of entrants, the likelihood of getting picked twice is slim.

"The chances are two thirds of one percent. It's pretty low," said Ansari, who lives in San Francisco on a temporary business visa and is launching a new dating website he created. "It's disappointing."

While Ansari plans to look for other routes to American citizenship, for many people the diversity visa is the only option. Other visas are based on family connections, employer sponsorships or having suffered from political persecution.

"It's a broken system, but at least it's a door," Ansari said of the random lottery. "A lot of people cannot come to this country unless they are really educated."