PARIS -- A man who fatally stabbed two women outside Marseille's main train station was detained for shoplifting and released the day before the attack, and used seven fake identities in previous encounters with police, officials said Monday.

French authorities are studying the suspect's cellphone and working to determine his true identity and whether he had direct links to the Islamic State of Iraq and Syria (ISIS), which claimed responsibility for Sunday's stabbing. The assailant was killed by soldiers immediately after the attack, the latest of several targeting France.

The suspect was identified by his fingerprints, which matched those taken during seven previous incidents registered by police since 2005, Paris Prosecutor Francois Molins told reporters.

Get Breaking News Delivered to Your Inbox

The attacker didn't have any past convictions in France, Molins said. The man's most recent arrest occurred in the Lyon area Friday - just two days before the train station stabbing.

People install flowers and candles in tribute to the two women who were stabbed to death Sunday by a knife attack at the main train station in Marseille, France, on Mon., Oct. 2, 2017. Reuters

The man was held overnight for shoplifting, then released Saturday and the charges dropped, Molins said. He added that local authorities had no reason to hold him further based on the ID he gave them -- a Tunisian passport.

French Interior Minister Gerard Collomb, apparently not satisfied with the explanation, on Monday ordered a probe of the circumstances that led police to free the man, who attacked and killed the young women a day later. The report is due by week's end, a ministry statement said.

While being held in Lyon, the man told police that he did odd jobs, used hard drugs and was divorced, according to Molins, the prosecutor. It's not clear if the attacker had any connection to the victims.

CBS News partner BBC News reports the victims were cousins, both aged 20.

Some witnesses reported hearing the assailant shout "Allahu akbar!" -- Arabic for "God is great" -- and Molins said that's one of the reasons prosecutors opened a terrorism investigation. But no firm evidence has surfaced linking the man to Islamic extremism.

Molins said video surveillance of the site showed the man sitting for a few minutes on a bench outside the station, before jumping up and stabbing one woman several times. He then ran away and returned to attack the second woman.

BBC News writes that one victim had her throat slit and the other was stabbed in the stomach.

A woman passer-by tried to intervene, Molins said. The man then tried to attack soldiers patrolling the site, but they shot him dead with two bullets.

The suspect was found with two knives and a telephone, but no identity papers, according to Molins.

Police investigators work outside the Saint-Charles train station in Marseille, France, after French soldiers shot and killed a man who stabbed two women to death on Oct. 1, 2017. Reuters

French President Emmanuel Macron said he was disgusted by the "barbarous act" and paid tribute to the soldiers and the police officers who responded, BBC News reported.

The man's multiple pseudonyms made it difficult to even find a house to search for more clues, said Yves Lefebvre of the Unite SGP Police union.

"While it could shock the public, unfortunately it doesn't shock us, the police" that the suspect was released the day before carrying out a deadly attack, he said. He said shoplifting usually results in a quick police report and a court summons, and the suspect is released.

"Nothing allowed us to suspect there was a threat of radicalization during the (Lyon) arrest," Lefebvre told The Associated Press. He said that while the man didn't provide a residency permit, jails and migrant retention centers are often overflowing, so authorities do not routinely lock up illegal immigrants suspected of minor crimes.

However, the interior minister demanded a report to "shed full light" on the man, procedures followed and the decision not to expel him, the ministry statement said.

The ISIS-linked Aamaq news agency said that the assailant was acting in response to the extremist group's calls to target countries in the U.S.-led coalition fighting militants in Syria and Iraq. France has been part of the anti-ISIS coalition since 2014. The Aamaq statement didn't provide details, and it's unclear if the claim is merely opportunistic.

The small town of Eguilles in southern France held a memorial gathering Monday evening for the victims, a medical student from Eguilles, identified as 20-year-old Mauranne, and her cousin, Laura. Villagers gathered to sign a book of condolences. Officials have withheld the young women's last names.

Marseille's Saint Charles station reopened Monday under heavy security. Last month, four American college students were attacked with acid at the same station by a woman authorities said was suffering from mental illness.

Since January 2015 France has suffered a spate of jihadist attacks that have claimed more than 240 lives in total, according to the BBC.