Police had been hunting the second teenager who killed a priest in a church in France this week after a foreign intelligence tipoff 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 radicalized. 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.