France's highest constitutional authority has approved a controversial bill that significantly expands the government's surveillance powers. In a decision handed down Thursday night, the Constitutional Council ruled that all but three of the bill's provisions are in line with the French constitution, allowing the law to go into effect despite vehement opposition from civil liberties groups.

The bill, which was passed by France's parliament in May, allows the government to monitor the phone calls and emails of suspected terrorists without prior authorization from a judge. It also calls for internet service providers to install so-called black boxes that sweep up and analyze metadata on millions of web users, and forces them to make that data freely available to intelligence organizations. Intelligence agents will be able to plant microphones, cameras, and keystroke loggers in the homes of suspected terrorists.

"wildly out of proportion."

Prime Minister Manuel Valls has championed the measures as essential to defending France against terrorism, though civil rights groups say the law gives disproportionate power to the government. Under the law, the government can authorize surveillance for vaguely defined reasons such as "major foreign policy interests" and preventing "organized delinquency." The UN Human Rights Council expressed concern over the law earlier this week, saying it lacks sufficient oversight.

The bill was pushed through after armed gunmen orchestrated a string of attacks that began at the Paris offices of the satirical magazine Charlie Hebdo in January. It faced little political opposition, but was roundly criticized by French web hosting companies and international privacy groups, who compared it to the US Patriot Act. French President François Hollande asked the Constitutional Council to review the bill after it was definitively approved in June, marking the first time that a president has deferred to the courts before allowing a law to go into effect.

On Thursday, the council struck down three of the law's provisions, including one that would have allowed the government to intercept any communications sent or received overseas. Another rejected provision would have allowed intelligence services to carry out surveillance without authorization from the prime minister when faced with "urgent threats."

#LoiRenseignement: la France a désormais un cadre sécurisé contre le terrorisme et respectueux des libertés. C’est un progrès décisif! MV — Manuel Valls (@manuelvalls) July 23, 2015

Valls celebrated the council's decision on Twitter, saying that "France now has a secure framework against terrorism" that respects civil liberties, while advocacy groups were quick to excoriate it.

"The surveillance measures authorized by this law are wildly out of proportion," said Gauri van Gulik, Amnesty International's deputy director for Europe and Central Asia. "Large swathes of France’s population could soon find themselves under surveillance on obscure grounds and without prior judicial approval."

"The US and UK security agencies’ mass surveillance was denounced globally," van Gulik added in a statement, "yet French authorities appear to want to mimic their American and British counterparts in allowing the authorities to intercept and access people’s communications at will."