Officials on Thursday identified the second man who attacked a Normandy church during a morning Mass this week, saying he is a 19-year-old from eastern France who was spotted last month in Turkey as he supposedly headed to Syria — but who returned to France instead.

The prosecutor's office identified him as Abdel-Malik Nabil Petitjean following DNA tests. A security official confirmed that he was the unidentified man pictured on a photo distributed to police four days earlier with a warning that he could be planning an attack.

Petitjean and another 19-year-old, Adel Kermiche, were killed by police as they left the church Tuesday in Saint-Etienne-du-Rouvray after having fatally slashed the throat of the elderly priest. An elderly man among the five people in the congregation was also seriously wounded.

The attack was claimed by the Islamic State group, which released a video Wednesday allegedly showing Kermiche and his accomplice clasping hands and pledging allegiance to the group.

Petitjean was born in eastern France, in Saint-Die-des-Vosges, but recently lived in Aix-les-Bains, where his mother lives, the prosecutor's office said. Kermiche was from Saint-Etienne-du-Rouvray.

A man detained after the attack was still being held for questioning, the prosecutor's office said.

A security official said Turkey spotted Petitjean at an airport going to Syria on June 10, and that on June 29 he was signaled to France and immediately put on a special watch list.

"But he didn't go to Syria," said the official who was not authorized to discuss the case and asked not to be identified by name. "He turned around" and returned to France on June 11.

That information was gleaned as police and intelligence officials tried to track back to learn the identity of the second attacker.

The agency that coordinates the anti-terrorist fight, UCLAT, issued the photo of a man on July 22, warning police that this person — without a name but who turned out to be Petitjean — "could be ready to participate in an attack on national territory."

The UCLAT flyer to law enforcement, obtained by The Associated Press, told police its information came from a trusted source.

It said the person in the photo "could already be present in France and act alone or with other individuals. The date, the target and the modus operandi of these actions are for the moment unknown."

It was not immediately clear how the two men knew each other or when Petitjean traveled from eastern France to Normandy, in the west.

The church attack came less than two weeks after an attack by a man barreling his truck down a pedestrian zone in Nice, on the Riviera, that killed 84 people celebrating France's national day.

The Islamic State group claimed responsibility for that attack, too, as well as two attacks that followed in Germany.