A knife-wielding attacker shouting "Allahu Akbar" (God is Greatest) beheaded a woman and killed two other people in a church in the French city of Nice.

A defiant President Emmanuel Macron declared that France had been subject to an Islamist terrorist attack.

Mr Macron said he would deploy thousands more soldiers to protect important French sites, such as places of worship and schools.

Speaking from the scene, he 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 lots of clarity again today: we will not give any ground."

Police and security sources said the suspect was a 21-year-old Tunisian man, Brahim Aouissaoui

He is originally from the village of Sidi Omar Bouhajla near Kairouan, but had lately been living in Sfax and police visited his family there this afternoon.

According to a prosecutor, the man arrived by train carrying an Italian Red Cross identity document, changed his clothes at the train station, then walked to the church to begin his attack.

Jean-François Ricard, France's chief anti-terrorist prosecutor, said the attacker was a Tunisian born in 1999 who had arrived in Paris on 9 October.

The prosecutor said the man had been caught on video surveillance at the railway station in Nice, and from there had walked the 400 metres to the Notre Dame church.

Taoiseach Micheál Martin said he had spoken with President Macron and said Ireland offered it's solidarity in the wake of the attack.

In Saudi Arabia, meanwhile, state television reported that a Saudi man had been arrested in the Red Sea city of Jeddah after attacking and injuring a guard at the French consulate.

The French Embassy said he was in hospital after a knife assault though his life was not in danger.

Within hours of the Nice attack, French police killed a man who had threatened passersby with a handgun in Montfavet, near the southern city of Avignon.

France's Le Figaro newspaper quoted a prosecution source as saying the man was undergoing psychiatric treatment, and that they did not believe there was a terrorism motive.

Nice's mayor, Christian Estrosi, said the attack in his city had happened at Notre Dame church and 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.

The attacks, on the birthday of the Prophet Muhammad, came at a time of growing Muslim anger at France's defence of the right to publish the cartoons.

Protesters have denounced France in street rallies in several Muslim-majority countries.

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

The French Ambassador to Ireland described today's attack in Nice as "absolutely tragic".

Speaking on RTÉ's Drivetime, Vincent Guérend said he was shocked that such an attack could take place and that it would happen to elderly worshipers in a church.

He said that the country would remain united and not give in to terror, adding that they must fight against those who plan and carry out such acts.

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

Mr Estrosi said the Nice attacker had repeatedly shouted "Allahu Akbar" even when detained by police.

At around 9am (8am Irish time), a man armed with a knife entered the church and stabbed the sexton, beheaded an elderly woman, and badly wounded a third woman, according to a police source.

The sexton and the elderly woman died on the spot, the third woman managed to make it out of the church into a nearby cafe, where she died, Mr Estrosi told reporters.

None of the victims has so far been named.

"The suspected knife attacker was shot by police while being detained. He is on his way to hospital, he is alive," he said.

"Enough is enough. It's time now for France to exonerate itself from the laws of peace in order to definitively wipe out Islamo-fascism from our territory."

Journalists at the scene said police armed with automatic weapons had put up a security cordon around the church, which is on Nice's Avenue Jean Medecin, the French Riviera city's main shopping thoroughfare.

Ambulances and fire service vehicles were also at the scene.

Scene of the attack outside Charlie Hebdo's former offices in Paris

US President Donald Trump voiced sympathy for the people of France after the attack.

"America stands with our oldest Allyin this fight. These Radical Islamic terrorist attacks must stop immediately. No country, France or otherwise can long put up with it!" Mr 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 Mr Macron and France over displays of the Prophet Muhammad.

Turkish Presidential Communications Director Fahrettin Altun said Islam could not be used in the name of terrorism.

He added:"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."

Pope Francis condemned the attack as "savage" and the Vatican said terrorism and violence were never acceptable.

"Informed of the savage attack which was perpetrated this morning in a church in Nice, causing the death of several innocent people, His Holiness Pope Francis joins in prayer with the suffering of the families and shares their grief," said a message sent in his name to the bishop of Nice.

It said the pope condemned "in the most energetic manner such violent acts of terror" and urged the French people to remain united.

Minister for Foreign Affairs Simon Coveney has said Ireland stands with France and the French people "in the face of violence and terrorism".

European Commission President Ursula von der Leyen condemned the attack, calling it an "odious and brutal attack".

She said the whole of Europe stood in solidarity with France and remained united and determined "in the face of barbarism and fanaticism".

UN Secretary-General Antonio Guterres condemned the attack.

Spokesman Stephane Dujarric said Mr Guterres "strongly condemns the heinous attack today that took place in Notre Dame's Basilica in Nice".

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

The mayor of Paris, Anne Hidalgo, said the people of Nice "can count on the support of the city of Paris and of Parisians".

A representative of the French Council for the Muslim Faith also condemned the attack.

"As a sign of mourning and solidarity with the victims and their loved ones, I call on all Muslims in France to cancel all the celebrations of the holiday of Mawlid."

France is still reeling from the killing by a man of Chechen origin of Mr Paty in a Paris suburb earlier this month.

The assailant said he wanted to punish Mr Paty for showing pupils cartoons of the Prophet Muhammad to his pupils.

France, with Europe's largest Muslim community, has suffered a string of Islamist militant attacks in recent years.

These include 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.