New rules to provide help for France's intelligence services trying to prevent Islamist attacks have been approved by parliament.
The law on intelligence-gathering comes nearly four months after three days of attacks in Paris in January, in which 17 people were killed.
The Socialist government says the law is needed to take account of changes in communications technology.
But critics say it is a dangerous extension of mass surveillance.
They argue that it gives too much power to the state and threatens the independence of the digital economy.
The government says it wants to bring modern surveillance techniques within the law rather than outside any system of control.
There will be a new watchdog to keep an eye on the intelligence services, which will have broader powers to look at classified material and handle complaints from the public.
But none of this has satisfied the critics, who range from civil liberties groups to major internet providers.
Their main worry is the way French intelligence agencies will be able to collect massive amounts of metadata from the internet - the detail of communications such as times and places rather than content.
Critics say this amounts to a mass intrusion of privacy, which in the hands of an unscrupulous government could have worrying consequences.
The law passed through parliament by 438 votes to 86. Apart from some dissident voices, both the governing Socialists and opposition centre-right were in favour.Those opposed to the proposed new law say that it will allow the government to keep a record of innocuous conversations
It has been an unusual debate. Many in the Socialist Party who would normally have spoken out against the new powers have instead kept quiet. In the wake of the January attacks, there is little political mileage in raising doubts about the intelligence services.
Meanwhile on the right, with its clearer law-and-order tradition, most MPs support the Socialist bill. But some are opposed on points of principle. Irony of ironies, some of the harshest criticism has come from the Front National.
The consensus means that the powerful civil liberties arguments have had little of an airing in the National Assembly. In some sessions there were no more than a handful of deputies in attendance.
But the opposition from outside the chamber has been vocal. Not necessarily from the public at large (who by and large sympathise with the government's argument) but from rights groups, the press, and Internet companies.