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 on Thursday before being shot and taken away by police.

President Emmanuel Macron said France would deploy thousands more soldiers to protect important sites such as places of worship and schools, as the country'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."

The attack came just under two weeks after a middle-school teacher in a Paris suburb was beheaded by an 18-year-old attacker who was apparently incensed by the teacher showing a carton of the Prophet Mohammad in class.

Chief anti-terrorist prosecutor Jean-Francois Ricard said the suspect in Thursday's attack 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.

Newsletter signup for email alerts

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 fled to a nearby cafe where she raised the alarm before dying, Ricard said. Police then 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 specialized 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 by a Chechen man earlier this month near Paris of teacher Samuel Paty, who had used cartoons of the Prophet Mohammad in a civics class about freedom of expression.

Thursday's attacks, on the birthday of the Prophet Mohammad, came at a time of growing Muslim anger at France's defense of the right to publish the cartoons, and protesters have denounced France in street rallies in several Muslim-majority countries.

SECURITY ALERT RAISED

After the Nice attack, Prime Minister Jean Castex raised France's security alert to its highest level.

Police armed with automatic weapons set up a security cordon around the church, which is on Nice's Avenue Jean Medecin, the French Riviera city's main shopping thoroughfare.

In Paris, lawmakers in the National Assembly observed a minute's silence.

U.S. President Donald Trump voiced sympathy for the people of France after the attack. "America stands with our oldest Ally in this fight. These Radical Islamic terrorist attacks must stop immediately. No country, France or otherwise can long put up with it!" Trump said in a Twitter post.

Condemnations of the attack also came from Britain, the Netherlands, Italy, Spain, Saudi Arabia and Turkey, whose President Tayyip Erdogan earlier this week slammed Macron and France over displays of the Prophet Mohammad.

Turkish Presidential Communications Director Fahrettin Altun said Islam could not be used in the name of terrorism, adding: "We call on the French leadership to avoid further inflammatory rhetoric against Muslims and focus, instead, on finding the perpetrators of this and other acts of violence."

The foreign ministry of Saudi Arabia, the birthplace of Islam, said "extremist acts" such as that in Nice "contravene all religions, while stressing "the importance of avoiding all practices which generate hatred, violence and extremism."

France, with Europe's largest Muslim community, has suffered a string of Islamist militant attacks in recent years, including bombings and shootings in 2015 in Paris that killed 130 people and a 2016 attack in Nice in which a militant drove a truck through a seafront crowd celebrating Bastille Day, killing 86.

A representative of the French Council for the Muslim Faith also condemned Thursday's attack and called on all Muslims in France to cancel celebrations of the Mawlid holiday that marks the Prophet's birthday, as a sign of mourning and solidarity.

(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, Hugh Lawson and Daniel Wallis)