The U.S. Supreme Court on Friday ruled in favor of the FBI in a case concerning discrimination claims by three Muslim men from California who accused the agency of conducting illegal surveillance on them after the Sept. 11, 2001, attacks on the United States.

The court unanimously overturned a lower court's 2019 ruling that said a federal law regulating government surveillance called the Foreign Intelligence Surveillance Act (FISA) trumped the state secrets privilege - a legal defense based on national security interests - that the government asserted.

The ruling means the case returns to lower courts for further litigation, with the claims made by the plaintiffs not yet dismissed.

The Supreme Court faulted the San Francisco-based 9th U.S. Circuit Court of Appeals' analysis, with Justice Samuel Alito writing that the FISA provision in question "does not displace the state secrets privilege."

The lawsuit accused the FBI of infiltrating mainstream mosques in Southern California and targeting Muslim Americans for surveillance because of their religion. It accused the FBI of engaging in religious discrimination in violation of the U.S. Constitution's First Amendment by targeting Muslims, as well as violating the Fourth Amendment prohibition on unreasonable searches and seizures.

The plaintiffs are: Eritrean-born U.S. citizen Yassir Fazaga, an imam at the Orange County Islamic Foundation in Mission Viejo; native-born U.S. citizen Ali Uddin Malik, who attended the Islamic Center of Irvine; and Yasser Abdel Rahim, a U.S. permanent resident from Egypt who also attended the Islamic Center of Irvine. They are represented by the American Civil Liberties Union and others.

The lawsuit focused upon a 14-month period in 2006 and 2007 when the FBI paid an informant named Craig Monteilh to gather information on Muslims as part of a post-Sept. 11 counterterrorism investigation. Monteilh met with Muslims in southern California, adopted a Muslim name and said he wanted to convert to Islam, according to court papers. Monteilh also recorded conversations and conducted surveillance, according to court papers.

The arrangement unraveled when Monteilh started making statements about wanting to take violent action. Community members reported him to the local police and obtained a restraining order against him, according to court papers.

A federal judge in 2012 dismissed the claims against the FBI, determining that they were barred under the state secrets privilege. The judge did permit claims accusing some individual FBI agents of violating the surveillance law.

The 9th Circuit ruled that the religious claims should instead be analyzed under a section of the FISA law that lets judges review the legality of surveillance. The 9th Circuit also allowed the unlawful search claims, not at issue before the Supreme Court, to move forward.