A Tunisian man who killed three people in a church in France only recently arrived in Europe.
Officials say, the suspect, 21, had an Italian Red Cross document, issued after he arrived on the Italian island of Lampedusa by migrant boat last month.
The French chief anti-terrorism prosecutor said he was shot by police and is in a critical condition and one of the victims was “virtually beheaded”.
President Emmanuel Macron said it was an “Islamist terrorist attack”.
Mr Macron said the number of soldiers being deployed to protect public places – such as churches and schools – would rise from 3,000 to 7,000. Anti-terror prosecutors have opened an investigation, and France has raised its national security alert to the highest level.
In another development, a 47-year-old man believed to have been in contact with the attacker was detained by police late on Thursday, French media reported.
Thursday’s stabbings at a church in the southern city of Nice have echoes of another attack earlier this month near a school north-west of Paris. Samuel Paty, a teacher, was beheaded days after showing controversial cartoons of the Prophet Muhammad to some of his pupils.
That murder has heightened tensions in France. President Macron’s defence of the right to publish the cartoons and the government’s attempts to crack down on radical Islam have angered Turkey and other Muslim-majority countries.