(Updates with details, quotes from French prosecutor)
By Tangi Salaün and Eric Gaillard
PARIS/NICE, France, Oct 29 (Reuters) - A knife-wielding Tunisian man shouting "Allahu Akbar" (God is Greatest) beheaded a woman and killed two other people in a church in the French city of Nice before being shot and taken away by police on Thursday.
French President Emmanuel Macron said France would deploy thousands more soldiers to protect important sites such as places of worship and schools. France's security alert was raised to its highest level.
Speaking outside the church, Macron said France had been attacked "over our values, for our taste for freedom, for the ability on our soil to have freedom of belief ... And I say it with great clarity again today: We will not give any ground."
Chief anti-terrorist prosecutor Jean Francois Ricard later said the suspect was a Tunisian man born in 1999 who had arrived in Europe on Sept. 20 in Lampedusa, the Italian island off Tunisia that is the main landing point for migrants from Africa.
A Tunisian security source and a French police source named the suspect as Brahim Aouissaoui.
Ricard told a news conference in Nice that the man had entered the city by train early on Thursday morning and made his way to the church, where he stabbed and killed the 55-year-old sexton and beheaded a 60-year-old woman.
He also stabbed a 44-year-old woman who escaped to a restaurant nearby where she died minutes later, Ricard said, before police arrived and confronted the attacker, still shouting "Allahu Akbar", and shot and wounded him.
"On the attacker we found a Koran and two telephones, the knife of the crime - 30cm with a cutting edge of 17cm. We also found a bag left by the attacker. Next to this bag were two knives that were not used in the attack," Ricard said.
The suspect is in hospital in critical condition, he said.
Tunisia's specialised counter-militancy court spokesman Mohsen Dali told Reuters that Aouissaoui was not listed by police there as a suspected militant.
He said Aouissaoui left the country on Sept. 14 by boat, adding that Tunisia had begun its own forensic investigation into the case.
Nice's mayor, Christian Estrosi, said the attack was similar to the beheading earlier this month near Paris of teacher Samuel Paty, who had used cartoons of the Prophet Mohammad in a civics class.
Thursday's attacks, on the birthday of the Prophet Mohammad, came at a time of growing Muslim anger at France's defence of the right to publish the cartoons, and protesters have denounced France in street rallies in several Muslim-majority countries.
(Reporting by Sudip Kar-Gupta in Paris, Maher Chmaytelli and Raya Jalabi in Dubai, Angus McDowall in Tunis and Doina Chiacu in Washington; Writing by Christian Lowe and Giles Elgood; Editing by Mark Heinrich and Hugh Lawson)
Our Standards: The Thomson Reuters Trust Principles.