French police at Marseille's main station shot dead a suspect believed to have attacked people with a knife on Sunday.

Two victims were stabbed to death in the attack, which happened at about 1.45 p.m. (1145 UTC), local news outlets said.

The man allegedly shouted "Allahu Akbar" before being shot dead by security forces, local newspaper La Provence reported.

The "Islamic State" (IS) claimed responsibility for the attack in a post on its Amaq propaganda agency, describing the assailant as one of the group's "soldiers."

Anti-terror police said they were opening a probe into the attack, focusing on "killings linked to a terrorist organization" and the "attempted killing of a public official."

Read more: Jihadi arrests in EU nearly double in 2 years: Europol

The attacker stabbed two people to death before being shot dead by police

A witness told the Reuters news agency that she saw a man pull out a knife from his sleeve and then stab a young girl and a woman while shouting something that sounded like 'God is greatest' in Arabic.

A second onlooker told French broadcaster LCI she narrowly avoided the attack. "He attacked a girl who was on a bench five or six meters [16 to 20 feet] from me. He grabbed her neck. I thought, 'I'm dreaming, it's a nightmare.' And then he started to shout "Allahu Akbar," and I didn't try to comprehend it, I ran away. I just saw that girl was bleeding to death. Some guys tried to stop it. I have two grandchildren, I was thinking about my life. Then there were shots fired," she said.

Witnesses and social media users shared images of the station being evacuated.

Medical intern Lione told Le Figaro newspaper panic gripped people in the station. "Everyone ran out running and screaming. That's when I heard two shots fired," he was quoted as saying. "In less than 5 minutes, dozens of policemen arrived from all sides and blocked all access," the 23-year-old commuter said.

Could have been more victims

French President Emmanuel Macron said in a French-language post on Twitter that he was "deeply disgusted" by the attack.

"Deeply outraged by this barbaric act, grieving for the families and loved ones of the victims of Marseille. I would like to salute the Sentinelle soldiers and police officers who reacted in a calm and efficient manner," Macron wrote.

The office of the mayor of Marseille was quoted by the Le Parisien newspaper paying tribute to the Sentinelle forces saying "the number of victims could have been higher." France's interior minister said he was heading to the city in the south of France following the attack. The Sentinelle security force was created after Islamist attacks in 2015.

Police said the alleged attacker was in his 30s and was known to police and had a criminal record.

Witnessed described a knife-wielding attacker grabbing a girl on a bench

The Marseille incident came just days after the leader of IS released a recording urging his followers to strike their enemies in the West. In September, four American college students were splashed with acid at the train station by an assailant said to be suffering from a mental illness.

The latest attacked caused train delays in the port city.

France is in its 21st month of a state of emergency. French President Emmanuel Macron intends to introduce a new bill permanently enshrining counterterrorism measures, which he claims will sufficiently replace the state of emergency.

aw/jlw (Reuters, AFP, dpa, AP)