Meant to curb the influence of jihadist websites and online propaganda, it set a two-year prison sentence for consulting jihadist websites regularly, making exceptions for purposes of research or informing the public.

The Paris prosecutor's office said police discovered the lab with the explosive TATP in the raid in Montpellier, southern France.

France has been under a state of emergency since the November 2015 Paris attacks.

Last week, a soldier shot and wounded an attacker armed with a machete outside the Louvre museum in Paris while shouting "Allahu Akbar" (God is greatest).

Investigators have identified the suspect as a 29-year-old Egyptian Abdullah Reda al Hamamy, and are trying to establish if he has any links to extremist groups.

"The four suspects were arrested after they bought acetone", a police source told AFP, referring to a highly-explosive liquid that can be used to make bombs. His 16-year-old girlfriend, the minor female suspect, had recorded on February 8 a video in which she pledged allegiance to the Islamic State (IS).

A top court in France struck down a law that banned internet users from regularly consulting "terrorist websites".

The Constitutional Council found that the law infringed on people's freedom of communication unnecessarily.

The girl, a convert to Islam, was arrested in Kundby, near the capital, in January a year ago, and had been held in custody ever since.

The 20-year-old man had been her mentor and had been under surveillance, the source added, and he had been planning "to blow himself up".