The US Supreme Court has ruled in favor of the FBI in the case brought by 3 Muslims who accused the agency of spying on them after the September 11, 2001 attacks.

The Supreme Court unanimously held that the US government has the right to invoke state secrets to refuse to provide information to the court responsible for examining the complaint of the three Muslims.

The ruling - issued on Friday - cancels a decision made by a US appeals court in 2019 and returns the file to it to continue examining the case.

The court had held that a federal law regulating government surveillance practices obligates the state secrets argument on which the government relied.

The ACLU, which represents the plaintiffs, denounced the Supreme Court's ruling as a "dangerous sign of religious freedom," adding, "But we are not at the end of the road" and "we will continue to fight."

And confirms the three Muslims living in California that the FBI planted in 2006 and 2007 an informant in their mosque to collect information on its pilgrims.

They said the informant, who presented himself as a recent convert to Islam, collected phone numbers and email addresses, and secretly recorded conversations with several mosque-goers.

The man asked the worshipers questions about the bombings and attacks, which raised their concern and made them report him to the police, only to find out that he worked for the federal police.

The mosque's imam and two worshipers sued the FBI, alleging violations of religious freedom and discrimination.

The Ministry of Justice responded that it launched the monitoring program for objective reasons and not because they were Muslims.

The ministry invoked state secrets to refuse to elaborate on these reasons, and asked the courts to drop the case.