France's Constitutional Council has ruled that a bill legalizing broad surveillance of terrorism suspects doesn't violate the country's constitution.

Friday's decision was the final step before the law can come into effect.

The bill was proposed long before the January attacks in Paris by Islamic extremists, but the government said that had added to its urgency.

One measure will force communication and Internet firms to allow intelligence services to install electronic "lock-boxes" to record metadata from all Internet users in France, allowing algorithmic analysis to detect potentially suspicious behavior.

The data will be anonymous, but intelligence agents could follow up with a request to an independent panel for deeper surveillance that could identify users.

The measure has drawn harsh criticism from advocates of civil liberties.