PARIS -- French officials on Thursday identified the second man who attacked a Normandy church during morning Mass, saying he's 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 on his corpse. A security official confirmed that he was the unidentified man pictured on a photo distributed to French police on July 22 with a warning that he could be planning an attack.

Four days later, Petitjean and another 19-year-old local man, Adel Kermiche, stormed the church in Saint-Etienne-du-Rouvray during Mass on Tuesday. They held five people hostage -- the priest, two nuns and an elderly couple -- before fatally slashing the priest's throat and seriously wounding the other man. Another nun at the Mass slipped away, raised the alarm, and the attackers were killed by police as they left the church.

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 the Alpine town of Aix-les-Bains where his mother lives, the prosecutor's office said. Kermiche was from Saint-Etienne-du-Rouvray, where the attack took place in northwest France.

A youth believed to be 16 was detained after the church attack is still being held for questioning, the prosecutor's office said.

A security official said Turkey spotted Petitjean at a Turkish airport going to Syria on June 10, and that on June 29 he was flagged to French authorities 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.

Although it's not clear what caused Petitjean to turn around, in recent months Islamic State propaganda has encouraged Western recruits in particular not to join extremists in the war zones in Syria or Iraq but to remain home and carry out attacks.

The French anti-terrorism co-ordinating agency, UCLAT, issued the photo of a man on July 22, warning police that the 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, 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 travelled from eastern France to Normandy, in the west.

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

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

A gathering this weekend to honour victims of the Nice attack was cancelled on Thursday, after authorities said law enforcement was too busy protecting against threats. A march Thursday in Saint-Etienne-du-Rouvray was still expected to take place, however.