A federal court ruled Tuesday that the Trump administration wrongly denied asylum to dozens of Iranian Christians and other religious minorities who were invited to seek asylum in the United States under a congressionally enacted program.

Judge Beth Labson Freeman of the U.S. District Court for the Northern District of California ruled that the Trump administration violated the Lautenberg Amendment by rejecting resettlement for a group of about 87 Iranian religious minorities who were invited to leave their homes and travel to Vienna, Austria, to be processed for resettlement into the United States to live with their families and worship without fear of persecution.

The Lautenberg Amendment was originally enacted in 1990 to facilitate the resettlement of Jews from the former Soviet Union but was later expanded to include religious minorities in the Shia Muslim nation of Iran. Many of the Iranian asylum seekers in Vienna had been waiting for about a year to finally be resettled into the United States under the Lautenberg-Specter program but were sent notices of ineligibility in February and risked being deported back to Iran.

Although the judge notes that no person is entitled to resettlement under the Lautenberg Amendment and that discretion of resettlement lies under the authority of the Department of Homeland Security, she states that the mass denial of the group violated the amendment because the government did not state “to the maximum extent feasible” the reason for the denial.

“DHS retains an enormous amount of authority and discretion to adjudicate refugee applications, but they do not have the discretion to violate the law,” Freeman wrote in the order.

Freeman ordered the DHS to re-open the refugee applications or deny the plaintiffs within 14 days and to do so in a way that complies with the terms of the Lautenberg Amendment.

“The court takes no position on, and has no authority to review, the ultimate determination of plaintiffs’ applications, so long as any re-issued notices comply with the Lautenberg Amendment and agency procedures,” the ruling states.

The case was heard on June 22. The refugees were represented by the International Refugee Assistance Project and San Francisco-based attorney Belinda Lee from the law firm of Latham & Watkins.

“The U.S. government had abandoned our Iranian refugee clients in a terrible, Kafkaesque situation — they had left their homes in Iran, sold their belongings, and traveled to Vienna with every expectation that they would soon be united with their family members in U.S., only to be told that their admission was denied ‘as a matter of discretion,'” IRAP litigation director Mariko Hirose said in a statement. “We are heartened that the court recognized that the government cannot simply violate the explicit, heightened protections that Congress gave to this group of refugees.”