Emmanuel Macron's candidate for Paris mayor, Benjamin Griveaux, withdrew from the race over a leaked sex video Friday, in a blow to the French president's party ahead of March local elections.

The 42-year-old MP said he opted to retreat to protect his family after a website published video excerpts of a man masturbating, accompanied by screengrabs of racy text messages, which it said came from the former government spokesman.

The images then spread on social media.

His swift exit marked a rare moment in a country where a politician's private life has long been considered out of bounds for the media, although there has been a hint of changing times.

France's interior minister vowed legal consequences for the unauthorised posting of the video, which was claimed by a controversial Russian activist and performance artist.

"After despicable attacks, I have decided to withdraw my candidacy," Griveaux said at AFP headquarters in Paris. "My family does not deserve this. No-one should ever be subjected to such abuse."

- 'Hypocrisy' -

Russian performance artist Pyotr Pavlensky told AFP he had put the video online in order to expose the ex-candidate's "hypocrisy", warning he planned to post more material on a newly-created "political porn platform".

"Benjamin Griveaux started his campaign with a monstruous lie, a disgusting hypocrisy, he used his family, his wife, his children to create a political image and present himself as an icon for all the fathers and husbands of Paris," he said.

Pavlensky made global headlines in 2013 after nailing his scrotum to Red Square in Moscow, and two years later doused the doors of the FSB secret police headquarters with petrol and set them on fire.

Even after winning asylum in France in 2017, Pavlensky and his partner in 2018 set fire to the entrance to the Bastille branch of France's central bank.

Having earlier told the Liberation newspaper that he got the images from a "source" who had a consensual relationship with Griveaux, he refused to divulge any further details about the video's origins.

Interior Minister Christophe Castaner emphasised it was illegal to post videos without the consent of their author and warned violations could be punished by significant fines and up to two years' imprisonment.

- 'How low will we sink?' -

The ambitious Griveaux helped found the president's Republic on the Move (LREM) party, but recent polls showed him trailing in third place in Paris, which Macron won comfortably in the 2017 presidential election.

Griveaux is a close political ally of Emmanuel Macron / © POOL/AFP/File

Macron tapped Griveaux to be the LREM's Paris mayoral candidate, causing a rift in the party that led to the president asking rival Cedric Villani to step aside.

Villani refused, triggering his exclusion from the ruling party.

But with France unused to the sort of political sex scandals that have ended so many careers in Britain, there was near universal support from across the spectrum for Griveaux.

Villani said the "undignified attack" that led to Griveaux's withdrawal was a "serious threat to our democracy" and offered his support to the former candidate, his wife and children.

Prime Minister Edouard Philippe expressed sympathy for Griveaux while government spokeswomen Sibeth Ndiaye bemoaned a "campaign of the lowest common denominator where all blows are allowed".

Socialist Paris Mayor Anne Hidalgo, who leads the race in opinion polls, called for "the respect of privacy and of people".

Socialist figure and former culture minister Aurelie Filippetti wrote on Twitter: "How low will we sink in shame and abomination? We don't leave men to the dogs now but to rats in the lowest depths of the sewers."

Striking a different tone was far-right National Rally leader Marine Le Pen who said Griveaux had behaved "irresponsibly" while saying he could have been the victim of a "set-up".

- 'Better without me' -

Wresting control of the capital would be a huge prize for Macron as he seeks to consolidate his base ahead of an expected re-election bid in 2022.

It would also help offset heavy losses he is expected to face in rural areas, where his policies have met fierce resistance and fired up the "yellow vest" protest movement.

His majority in parliament has also been hit by what the government admitted was a huge mistake when it voted down a proposed bill extending paid leave from work for parents who have lost a child.

One of Macron's closest political allies, Griveaux resigned as a junior minister and government spokesman in March last year to run for mayor.

Griveaux told AFP he had discussed the issue with Macron late Thursday, and that the president offered his support "whatever my decision".

As for the LREM's project for Paris, he said it would continue "better without me".

burs-mlr-sjw/har