Three people have died in a knife attack at a church in Nice, in what French President Emmanuel Macron said was an "Islamist terrorist attack".

He said France would not surrender its core values after visiting the Notre-Dame basilica in the southern city. An extra 4,000 troops are being deployed to protect churches and schools.

In Nice, one elderly victim was "virtually beheaded", officials said. Another woman and a man also died.

A male suspect was shot and detained.

Anti-terror prosecutors have opened an investigation into the attack and France has raised its national security alert to its highest level.

Police sources named the suspect as Brahim Aioussaoi, a 21-year-old Tunisian who arrived by boat on the Italian island of Lampedusa in September. He was placed in coronavirus quarantine there before being released and told to leave Italy. He arrived in France earlier this month.

Nice Mayor Christian Estrosi spoke of "Islamo-fascism" and said the suspect had "repeated endlessly 'Allahu Akbar' (God is greatest)".

Two other attacks took place on Thursday, one in France and one in Saudi Arabia.

A man was shot dead in Montfavet near the southern French city of Avignon after threatening police with a handgun.

A guard was attacked outside the French consulate in Jeddah in Saudi Arabia. A suspect was arrested and the guard taken to hospital.

Speaking after visiting Nice, President Macron said: "If we are attacked once again it is for the values which are ours: freedom, for the possibility on our soil to believe freely and not to give in to any spirit of terror.

"I say it with great clarity once again today: we won't surrender anything."

The president said the number of soldiers being deployed to protect public places across the country would rise from 3,000 to 7,000.

Mr Estrosi compared the attack to the recent murder of teacher Samuel Paty, who was beheaded close to his school outside Paris earlier this month.

Police have not suggested a motive for the attack in Nice. However, it follows days of protests in some Muslim-majority countries triggered by President Macron's defence of the publication of cartoons that depicted the Prophet Mohammed. There have been calls in some countries for a boycott of French goods.

Who were the victims?

All three were attacked inside the basilica on Thursday morning before the first Mass of the day.

Two died inside the church: the woman in her 70s who was "virtually beheaded", and a man in his 40s or 50s whose throat was cut, reports said.

The male victim is believed to have been a lay member of staff responsible for the upkeep of the church and had a wife and two children.

Another woman in her 30s or 40s managed to flee to a nearby cafe after being stabbed several times, but died later.

It later emerged that a witness had managed to raise the alarm with a special protection system set up by the city.

Chloe, a witness who lives near the church, told the BBC: "We heard many people shouting in the street. We saw from the window that there were many, many policemen coming, and gunshots, many gunshots."

Tom Vannier, a journalism student who arrived at the scene just after the attack, told the BBC that people were crying on the street.

The attacker was detained by police at about 09:10 local time (08:10 GMT), reports said.

Four years ago Nice was the scene of terrorist attack, when a Tunisian drove a truck into crowds celebrating Bastille Day on 14 July, killing 86 people.