PARIS: A policeman survived a knife attack in the French Riviera city of Cannes on Monday, with media quoting a police source as saying the assailant had said he was acting "in the name of the Prophet".

BFM TV and Le Figaro newspaper said the suspect was an Algerian national who held an Italian residency permit.

The policeman emerged from the attack unscathed, saved from serious injury or worse by his bulletproof vest, said Interior Minister Gerald Darmanin who added that the assailant had been "neutralised" by other officers.

Cannes Mayor David Lisnard said the incident was "sickening".

The attack comes as President Emmanuel Macron tries to persuade voters that his government is in control of security and violent crime, six months before elections in which the far right and conservatives pose the biggest threat to his re-election hopes.

Eric Ciotti, a conservative lawmaker from southeastern France, who is challenging for the mainstream centre-right presidential ticket, called the incident a terrorist attack though he did not offer any evidence for that.

The investigation is in the hands of the local prosecutor for now and not the national anti-terrorism prosecutor.

Darmanin said he would travel to Cannes, a glitzy Mediterranean resort popular with celebrities and tycoons, and which hosts the annual Cannes Film Festival.

BFM TV, citing a police source, said the attacker opened the door of a police car stationed in front of a police station and stabbed the policeman at the wheel with a knife.

He then tried to attack a second policeman in the car but a third policeman opened fire, seriously wounding the attacker, it said.

BFM TV and Nice Matin newspaper cited a police source as saying the suspect said he had carried out the attack "in the name of the Prophet" Mohammad, hinting at possible Islamist militant links.

The attack coincides with the trial of Salah Abdeslam, the only surviving member of an Islamic State cell that carried out gun-and-bomb attacks on entertainment venues in Paris in November 2015, killing 130 people.