How France is wrestling with jihadist terror
France's anti-terror measures are under intense scrutiny again, because both of the Islamists who attacked a church in Normandy were known to the security services as potential threats and one of them was wearing an electronic surveillance tag.
After last year's jihadist atrocities in Paris, claimed by so-called Islamic State (IS), it emerged that many of the killers had also been on French anti-terror watch lists.
How does France monitor suspected jihadists?
There is a database called the S list (S standing for "state security") containing 20,000 names, of whom 10,500 are suspected jihadists.
Not all of them are under electronic surveillance. Besides jihadists there are also other political extremists and even hooligans, France's Le Figaro newspaper reports. The suspects are given various threat levels.
A traffic policeman who identifies an S list suspect during a routine check has a duty to alert the intelligence services and report on the suspect's companions.
The suspect can be arrested on the spot if an arrest warrant has already been issued for him or her.
Former President Nicolas Sarkozy, who leads the right-wing opposition party The Republicans, has called for all suspected jihadists on the S list to be electronically tagged.
After the jihadist murder of an elderly priest in a Normandy church on 26 July, The Republicans also called for S list suspects to be detained.
One of the alleged killers, 19-year-old Adel Kermiche, had been wearing an electronic tag, but a judge had reportedly allowed him free movement on weekday mornings. He had tried twice in 2015 to get to war-torn Syria, where IS is based, and was awaiting trial on terror charges.
With him for the church attack in Saint-Etienne-du-Rouvray was Abdel Malik Petitjean, also 19, who had also tried to reach Syria and been turned back. He was on the S list as a suspected jihadist but had not been required to wear a tag.
Last December, a top French court, the Council of State, warned the government that detaining suspected jihadists without evidence of a crime would violate their human rights.
Such a measure would also show the suspects that they were on a watch list - undermining the surveillance effort, it was argued.
"It's a problem of quality, rather than quantity," said Alain Bauer, a French professor of criminology. "The challenge is to prioritise the most dangerous cases and analyse them better," he told the BBC.
Why do jihadist atrocities continue in France?
A French parliamentary report on 5 July called for a major revamp of the intelligence services, after an analysis of last year's Paris attacks which killed 147 people.
The head of the inquiry, judge and politician Georges Fenech, said French intelligence was aware of the jihadists before the attacks, but the services had failed to exchange information about them.
There were also some operational failures, including the way the Bataclan concert hall siege was handled, he said in the report (in French).
The elite RAID anti-terror force should have gone to the Bataclan, instead of the city's BRI "anti-gang" force, he said.
Mr Fenech called for a new national anti-terror agency to be set up, answering directly to the president, to co-ordinate operations and collate data from the various intelligence services. It would be modelled on the US National Counterterrorism Center.
According to Frank Foley, a counter-terrorism expert at King's College London, "there are too many French agencies with similar missions, overlapping and competing with each other".
He said there was rivalry between the DGSI intelligence service and the police when the DGSI took charge of counter-terrorism, following the September 2001 attacks on the US by al-Qaeda.
The Paris attacks also highlighted the urgent need for more intelligence exchanges among European partners - in this case France and Belgium.
A major difficulty for France and other countries targeted by jihadists is the diversity of the criminals' profiles.
According to Mr Bauer, the idea of "lone wolf" jihadists who "self-radicalise" is misleading. "What's new is the range of different jihadists," he said.
The Nice beachfront attacker, who mowed down 84 people on 14 July with a massive lorry, did have a different profile from the Paris jihadists, some of whom had trained with IS in the Middle East.
What extra measures has France taken?
A state of emergency has been extended until the end of January 2017. It widens the powers of police to keep suspects under house arrest, to conduct searches and to break up groups posing a security risk.
In November, President Francois Hollande announced extra staff to deal with the terror crisis: 5,000 extra police; 1,000 more customs and border guards; 2,500 new justice officials and 9,200 army jobs saved from being axed.
Following the Normandy attack, he also urged "patriots" to sign up as reservists and said a new National Guard would be formed from reserve forces.
But extra numbers can only go so far to tackle a multi-faceted problem.
The government recognises that the profiles of suspected jihadists vary a lot - nearly 30% are women or girls and nearly 25% are "recent converts".
In many cases petty crime and social marginalisation already blight suspects' lives in the deprived suburbs (banlieues).
A government anti-terror website (in French) says 2,147 people in France are known to be linked to Iraqi or Syrian Islamist groups.
Dealing with those who return from the war zone "is a major challenge", it says. Prime Minister Manuel Valls has said 1,000 of that total visited the war zone and 898 "showed an eagerness to go there".
France has started isolating zealous jihadist recruiters in prisons, to stop them radicalising fellow prisoners.
About 20 were singled out at Fresnes prison, and five special prison wings will be built to house radicals convicted of terror offences.
But prison overcrowding is a problem, stretching France's prison staff. On 1 July the total number of prisoners was 69,375, and another 11,530 were under house arrest, most of them subject to electronic surveillance.
Prison numbers are more than 10,000 above the official capacity.