PARIS -- A man who fatally stabbed two women outside Marseille's main train station had been 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. He did not elaborate on the previous police incidents, but noted the man's most recent arrest occurred in the Lyon area Friday - just two days before the train station stabbing.

French police and soldier secure a street near the Saint-Charles train station after French soldiers shot and killed a man who stabbed two women to death at the main train station in Marseille, France, Oct. 1, 2017. Reuters

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

He told Lyon authorities that he did odd jobs, used hard drugs and was divorced. It's not clear if the attacker had any connection to the victims, two cousins meeting for a birthday celebration in Lyon, Molins said.

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.

He said video surveillance of the site showed the man arrived at the station in the early afternoon and sat for a few minutes on a bench outside. He then suddenly jumped up and stabbed one woman several times, then ran away, then came back and attacked the second woman.

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.

The man's multiple pseudonyms made it difficult to even to 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 for a later date, 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.

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 evidence of a direct link to the attacker, and it's unclear if the claim is merely opportunistic.

Marseille's Saint Charles station reopened as usual Monday but under heavy security. Last month, four American college students were attacked with acid at the same station. French authorities said the female assailant who doused the four Boston College students was suffering from mental illness.

A silent march was planned in honor of the victims in Marseille on Monday evening.