PARIS — On Wednesday, France woke up to find that the National Security Agency had been snooping on the phones of its last three presidents.

Top-secret documents provided by WikiLeaks to two media outlets, Mediapart and Libération, showed that the NSA had access to confidential conversations of France’s highest ranking officials, including the country’s current president, François Hollande; the prime minister in 2012, Jean-Marc Ayrault; and former presidents Nicolas Sarkozy and Jacques Chirac.

Yet also today, the lower house of France’s legislature, the National Assembly, passed a sweeping surveillance law. The law provides a new framework for the country’s intelligence agencies to expand their surveillance activities. Opponents of the law were quick to mock the government for vigorously protesting being surveilled by one of the country’s closest allies while passing a law that gives its own intelligence services vast powers with what its opponents regard as little oversight. But for those who support the new law, the new revelations of NSA spying showed the urgent need to update the tools available to France’s spies.

Of course, the fact that the NSA is listening to the conversations of French presidents is not that surprising to anyone who has been paying attention to the revelations in the past two years of NSA spying, nor is the idea that France might do the same to its allies. In 2013, the German newsmagazine Der Spiegel revealed that the U.S. government had targeted the cell phone of German Prime Minister Angela Merkel — so why not Hollande’s phone, too?

The response from the French government today was firm but predictable. Senior intelligence officials will travel to the U.S. to meet their counterparts in Washington, while the U.S. ambassador in Paris was summoned to the Elysee Palace. A similar scenario played out in 2013, when Le Monde published Snowden documents that revealed some of the extent of American surveillance in France. Prime Minister Manuel Valls said today that he wants a “code of conduct” to guide the relationship between France and the U.S. on intelligence activities — but the government demanded the exact same thing almost two years ago.

When The Intercept published NSA documents in March indicating the Five Eyes — the NSA’s core allies — were intercepting large swaths of internet traffic in France’s Pacific islands, an official protest from France was nowhere to be heard. Even when it appeared that France’s closest ally, Germany, was using its surveillance capabilities to spy, on behalf of the NSA, on France’s foreign affairs ministry and some of the country’s most strategic companies, French authorities remained silent.

This silence can be explained. We’re now aware, thanks to Snowden, that Western intelligence agencies know almost no boundaries when it comes to spying on friends and foes. We also know that Western intelligence agencies are connected by secret agreements and exchange large amounts of data that they collect for each other. To what extent do the French intelligence services collaborate with the NSA? Are they compelled, like Germany’s BND, to snoop on their European partners and allies in exchange for valuable intelligence from the NSA? Does France have the moral and political standing to direct tough words at the U.S. and oppose NSA spying in a meaningful way?

While the American government has seen its surveillance powers placed under greater scrutiny and modestly reformed in the wake of the Snowden revelations, France has gone in the opposite direction this year, due partly to the fatal attack by religious extremists on the satirical magazine Charlie Hebdo. The attacks — a kosher grocery was also targeted — prompted the French government to speed up the legislative process and focus its surveillance debate on terrorism, although the new law deals with multiple areas like counter-intelligence and the fight against economic espionage. The bill’s opponents were characterized as “pro-terrorist” — for instance, when the interior minister, Bernard Cazeneuve, told the National Assembly, “Those who attack human rights are not intelligence services, but terrorists.”

This had a numbing effect on the parliamentary debate. The bill was met with a great deal of protest outside the government: dozens of civil rights organizations, journalists’ unions and human rights activists strongly opposed it. Two years of revelations from the Snowden archives gave them ample ammunition to oppose the efficacy and ethics of expanded surveillance. Still, it faced little opposition in parliament, where it passed by a wide margin. If there’s one thing that can be learned from the debate around the law, it’s that France has not reached the post-Snowden world yet. The country had a narrow yet crucial window to impose robust oversight on its intelligence services and avoid the mistakes made in America after 9/11, but this opportunity has been missed.

Until the law was passed, France’s intelligence services operated almost without any laws to regulate them. Although the new law delivers a much-needed framework, its safeguards are regarded by many critics as insufficient. The powers of the oversight body in charge of the intelligence agencies have been slightly strengthened and it will be possible, if a citizen suspects she is being surveilled, to take her case before the Conseil d’Etat, France’s highest court. But other parts of the law have drawn controversy, including the way it defines the purposes the government can invoke to surveil French residents. The categories extend well beyond terrorism. Many opponents of the law think these guidelines are so broad that they could enable political surveillance. But the key point of disagreement is what the government calls “black boxes.” The law allows the use of government equipment inside Internet Service Providers and large web companies to analyze streams of metadata and find “terrorist” patterns and behaviors.

The country’s intelligence community got everything it wanted — almost. An amendment that would remove any oversight of surveillance of foreigners, targeting chief executives and foreign spies, had been demanded by France’s top spy, Bernard Bajolet, the director general of external security, during a hearing at the National Assembly a few weeks ago, but the government opposed it and managed to get rid of it before the final vote. Yet, the government added a last minute amendment that tears to pieces the meager whistleblower protection the bill was supposed to set up.

The end result is that most of what France’s intelligence services have been doing in the dark is now authorized by law.

Martin Untersinger is a reporter in Paris for Le Monde.

Photo Illustration: Chirac: Herbert Knosowski/AP; Hollande: Pascal Lachenaud/AFP/Getty; Sarkozy: Bernd Thissen/picture-alliance/dpa/AP