Police had been hunting the second teenager who killed a priest in a church in France this week after a foreign intelligence tip-off that a suspected jihadist might be preparing an attack, police and judicial sources said.
The revelation is likely to further fuel criticism by opposition politicians that President Francois Hollande's Socialist government did not do enough to stop the pair given that they were both already known to intelligence services.
They stormed a church service, forced a 85-year-old Roman Catholic priest to his knees at the altar and slit his throat. They were later shot and killed by police.
Police had already identified 19-year-old Adel Kermiche as one of the attackers. He had made failed bids to reach Syria to wage jihad, wore an electronic bracelet and was awaiting trial for alleged membership of a terrorist organisation having been released on bail.
They have now identified the second man as Abdel-Malik Nabil Petitjean, also 19, from a town in eastern France on the border with Germany, a judicial source told Reuters on Thursday.
A source close to the investigation said Petitjean was not known to French security services until a tip-off from Turkish authorities. He was stopped and questioned by profilers on his arrival at Istanbul's international airport on June 10 before he was allowed to continue on his way, a Turkish official said.
Turkey notified the French authorities in late June, the source said, and anti-terrorism officials opened up a special file, suspecting he had become radicalise. The government has said there are about 10,500 people with such so-called 'S files' related to potential jihadi activities in France.
But in the time it took security agencies in Turkey, a well-trodden entry point into Syria for foreign militants, to notify France, Petitjean had returned.
"We know that he turned around and returned on June 11," said the source. "The Turks hadn't yet flagged his name, so he came back normally, there was no file at this point, he wasn't known to us."
A second tip-off from an unidentified foreign intelligence source led to the French authorities circulating a photo to its security agencies on July 22 of a man believed to be planning an attack. They had no name to go on, but the police sources said there was now little doubt that the photo was of Petitjean.
The person in the photo also appears to be one of a pair seen in a video posted on Wednesday by Islamic State's news agency, the police sources said. The video claimed the two men were the church attackers and showed them pledging allegiance to Abu Bakr al-Baghdadi, Islamic State's leader.
Petitjean's mother Yamina told BFM TV that her son had never spoken about Islamic State.
A judicial source said that one man who had travelled to Turkey with Petitjean in June was among three people close to the teenager who were being detained in police custody.
Two opposition lawmakers on Thursday submitted a draft bill to parliament that would prohibit the media from publishing the identities and photographs of militant attackers to prevent their names being glorified in death.
Hollande under pressure
Tuesday's attack came less than two weeks after another suspected Islamist drove a truck into a Bastille Day crowd, killing 84 people.
Opposition politicians have responded to the attacks with strong criticism of the government's security record, unlike last year, when they made a show of unity after gunmen and bombers killed 130 people at Paris entertainment venues in November and attacked a satirical newspaper in January.
Hollande's predecessor and potential opponent in a presidential election next year, Nicolas Sarkozy, has said the government must take stronger steps to track known Islamist sympathisers.
A woman places flowers to pay tribute to French priest Father Jacques Hamel outside the parish church at Saint-Etienne-du-Rouvray, near Rouen, France, July 28, 2016.
He has called for the detention or electronic tagging of all suspected Islamist militants, even if they have committed no offence.
Kermiche's tag did not send an alarm because the attack took place during the four hour period when he was allowed out.
Interior Minister Bernard Cazeneuve rejected Sarkozy's proposal, saying that to jail them would be unconstitutional, and also counterproductive as many people did not know they were being watched.
Since the two most recent attacks the government has said that summer festivals that do not meet tight security standards are to be cancelled.
On Thursday, local authorities banned a procession in the city of Nice that was to have commemorated those who died there on July 14.
Since that Bastille Day killing, there has been a spate of attacks in Germany too, creating greater and wider alarm around Western Europe.
In Marseille, three men were put under investigation on Thursday after shouting 'Alluha Akbar' (God is great in Arabic) as they drove a boat repeatedly at the coast.
In Corsica, a dissident branch of the nationalist FLNC threatened reprisals against Islamic State and called on Muslims living on the Mediterranean island to demonstrate at their sides against radical Islam.