A knife-wielding man killed three people at a church in the French city of Nice on Thursday, slitting the throat of at least one of them, in what officials are treating as the latest jihadist attack to rock the country.

The assailant "kept repeating 'Allahu Akbar' (God is Greater) even while under medication" after he was injured during his arrest, Nice's Mayor Christian Estrosi told journalists at the scene.

A man and a woman died at the Basilica of Notre-Dame, in the heart of the Mediterranean resort city, while a third person succumbed to injuries after seeking refuge in a nearby bar, a police source told AFP.

No mass was underway at the time of the attack, but the church opens around 8:00 am and "people come in to pray at all hours," Father Philippe Asso, who serves at the basilica, told AFP.

Daniel Conilh, a 32-year-old waiter at the Grand Cafe de Lyon, a block from the church, said it was shortly before 9:00 am when "shots were fired and everybody took off running."

"A woman came in straight from the church and said, 'Run, run, someone has been stabbing people'," he told AFP, and dozens of police and rescue vehicles quickly sealed off the neighbourhood.

French anti-terror prosecutors have opened an inquiry into what Estrosi called an "Islamo-fascist attack".

French police at the Basilica of Notre-Dame de Nice in southern France on Thursday, when a knifeman killed three people. French police at the Basilica of Notre-Dame de Nice in southern France on Thursday, when a knifeman killed three people. Photo: AFP / Valery HACHE

France has been on terror alert since the January 2015 massacre at the satirical weekly Charlie Hebdo, which marked the beginning of a wave of jihadist attacks that have killed more than 250 people.

Tensions have run especially high since the trial of suspected accomplices in that attack opened in September, an event the paper marked by republishing cartoons of the Prophet Mohammed that infuriated millions of Muslims worldwide.

Just days later, an 18-year-old man from Pakistan seriously injured two people with a meat cleaver outside Charlie Hebdo's former offices in Paris.

Emmanuel Macron's office said the president would travel to Nice on Thursday, just days before French Catholics mark the All Saint's Day holiday on November 1.

In the city, painful memories remain fresh of the jihadist attack during the Bastille Day fireworks on July 14, 2016, when a man rammed his truck into a crowded promenade, killing 86 people.

Relatives of the victims of a knife gathered outside the Basilica of Notre-Dame in Nice Relatives of the victims of a knife gathered outside the Basilica of Notre-Dame in Nice Photo: AFP / Valery HACHE

Just a few days later, two teenagers murdered an 85-year-old priest as he conducted mass at his church in Saint-Etienne-du-Rouvray in northern France, an attack later claimed by the Islamic State group.

Thursday's attack drew condemnation from France's allies, with Germany's Angela Merkel voicing solidarity with France and EU Parliament President David Sassoli saying: "This pain is felt by all of us in Europe.

"We have a duty to stand together against violence and those that seek to incite and spread hatred," he said on Twitter.

Italy's Prime Minister Giuseppe Conte condemned a "vile attack" but vowed it "will not shake the common front defending the values of freedom and peace."

Abdallah Zekri, director general of the French Council of Muslim Worship (CFCM), said: "I can only denounce as strongly as possible this act of cowardice against the innocent."

Zekri called on French Muslims to cancel festivities to mark the Mawlid, or the Prophet's Birthday, which ends Thursday, "in solidarity with the victims and their loved ones."

Estrosi, meanwhile, called for churches around the country to be given added security or to be closed as a precaution.

The Nice attack comes just days after thousands rallied across France in solidarity with a teacher beheaded for having shown pupils cartoons of the Prophet Mohammed.

The history teacher, Samuel Paty, was killed by an 18-year-old Chechen man, Abdullakh Anzorov, who committed the gruesome crime outside Paty's school in a Paris suburb after the teacher was denounced by angry parents on social media.

His murder prompted Macron to promise a crackdown in Islamic extremism, including shutting down mosques and organisations accused of fomenting radicalism and violence.

But the move has inflamed tensions with many Muslims saying Macron is unfairly targeting France's estimated five to six million Muslims -- the largest community in Europe.

Protests against France have erupted in several Muslim countries, with some urging a boycott of French goods, and tensions have flared in particular between Macron and Turkey's President Recep Tayyip Erdogan.