Police guard the St. Charles train station in Marseille where a man fatally stabbed two women Sunday. (Nogier/Epa-Efe/Rex/Shutterstock/Nogier/Epa-Efe/Rex/Shutterstock)

The man who carried out the deadly weekend knife attack in the French port city of Marseille had been detained by police two days earlier and released on the eve of the stabbings, officials said Monday.

On Sunday afternoon, the attacker — who was later shot dead at the scene — stabbed two women to death at Marseille's main train station in an incident authorities immediately investigated as an act of terrorism. The man, whose exact identity remains unclear, had been arrested Friday on suspicion of shoplifting in the central city of Lyon, authorities said.

François Molins, the Paris prosecutor charged with investigating terrorism cases across the country, said the man had used seven different identities in dealing with police in the past.

When he was apprehended in Lyon, he presented police with a Tunisian passport that identified him as a 29-year-old named "Ahmed H," Molins said in a news conference in Marseille on Monday. But the prosecutor stressed that it was not clear whether the document contained the man's true identity.

In any case, none of the seven identities linked to the attacker appeared on any of France's terrorist watch lists, Molins said.

Late Sunday, the Islamic State, through its Amaq News Agency, claimed that the attacker was a "soldier" of the militant group, although Molins could not confirm any links between the man and any known terrorist group.

While in police custody in Lyon, the man reportedly told investigators that he was divorced, homeless and struggled with drug abuse.

Although the identification information the man provided in Lyon indicated that he was in France illegally — and Lyon authorities had been weighing deportation — he was ultimately released Saturday, Molins said.

According to French media, police sources in Lyon said that the man seemed like a petty criminal but that deportation depended on successful identification, which could not be achieved. The newspaper Le Parisien also reported that the Lyon detention center, where the man would have been taken, was full over the weekend.

The man attacked two women — cousins, both 20 — at the Marseille train station Sunday afternoon. Surveillance footage shows him stabbing one of them and then returning to attack the other. He slit one of the women's throats.

Since the beginning of 2015, terrorism has claimed 239 lives in France. Although the type of large-scale assaults seen in Paris in January and November 2015 and in Nice in July 2016 have largely been replaced by smaller-scale, isolated attacks, national security remains a contentious issue.

The Marseille attack comes at a particularly fraught moment: On Tuesday, Parliament is slated to vote on security provisions proposed by President Emmanuel Macron. The provisions would give authorities heightened powers to conduct house arrests and home searches. Critics say such broad authority would jeopardize civil liberties, especially for French Muslims.

Technically, authorities already enjoy some of these powers under a set of extrajudicial allowances known as the "state of emergency." That security regime has been in place since the day after the November 2015 Paris attacks, and Macron's proposed measures would replace it when it expires Nov. 1.