Emmanuel Macron’s candidate for mayor of Paris in next month’s municipal elections has been forced to stand down after the leak of sexual images and messages online, blaming what he called “vile” attacks on his private life on social media.

Benjamin Griveaux, who was standing for the president’s governing centrist La République En Marche (LREM) party, made the announcement on Friday morning less than 48 hours after the material was first posted to a website.

“My family does not deserve this. Nobody should ever be subjected to this kind of abuse,” Griveaux said in a statement after a crisis meeting at his Paris campaign headquarters.

“For more than a year, my family and I have been subjected to defamatory remarks, lies, rumours, anonymous attacks, the revelation of stolen private conversations and death threats. As if all this was not enough, yesterday a new level was reached.”

Griveaux has received support since he withdrew from the race from politicians including the prime minister, Edouard Philippe, plus others who would more usually be his opponent. “The publication of intimate images to destroy an adversary is odious,” said hard-left leader Jean-Luc Mélenchon.

A video and text messages to a young woman purportedly from Griveaux, whose campaign has been struggling against rivals including the Socialist incumbent, Anne Hidalgo, and the former LREM MP Cédric Villani, were published by a website late on Wednesday and then spread to social media.

The video shows a man performing a sex act on himself accompanied by the message “Me this morning when I wake up”. It appears Griveaux and the woman were exchanging messages and photographs.

The 42-year-old former spokesman for Macron’s government and his wife have three children and he has often mentioned them during his mayoral election campaign. Griveaux has not disputed that he sent the messages.

Griveaux was elected to parliament representing LREM in 2017 after Macron became president. His campaign for mayor was central to Macron’s attempt to control Paris’s city hall to build a local power base for his party, but he had alienated many within his own camp after a leaked conversation with journalists revealed disparaging remarks he had made about LREM rivals.

A Russian artist living in Paris and reportedly close to the gilets jaunes movement told the Libération newspaper he had released the video and messages to the young woman to “denounce the hypocrisy” of the candidate.

“He [Griveaux] is someone who is always mentioning family values. He said he would be the mayor of Paris families and citing the example of his wife and children, while doing the opposite,” said Petr Pavlensky. The artist, who was granted political asylum in France, hit the headlines after setting fire to the Bank of France in Paris in 2017 and in Russia had protested against authorities by nailing his scrotum to Red Square.

Facebook Twitter Pinterest Russian artist Petr Pavlensky speaks during a press interview about why he released the video. Photograph: Lionel Bonaventure/AFP via Getty Images

Having extra-marital affairs or any other legal sexual relationship is not considered an obstacle to public life in France. Perhaps the most famous example of this is François Mitterrand, who maintained a second family while president.

When the French press broke its omertà on this, the public was more scandalised by the fact the president had partly maintained his lover and their daughter using taxpayers’ money than by the fact he had a secret family.

Hidalgo, the favourite to win the mayoral election in March, called for people’s private lives to be respected, adding: “Parisians deserve a dignified debate.”

Villani, who is facing moves to expel him from the party for standing against Griveaux, said he sent the former rival and his family “my complete and total support during this difficult time”.

“The attack he has been subject to is a serious threat to our democracy,” Villani tweeted.

Alexis Corbière of the hard-left La France Insoumise said he regretted the “Americanisation” of French political life in which “people have to apologise for having lovers or mistresses”.

Griveaux’s lawyer, Richard Malka, warned any publication’s breaking France’s strict privacy laws would face legal action. The laws mean any intrusion into a person’s personal or “intimate” life is, in serious cases, punishable by fines and prison sentences.

Olivia Grégoire, a LREM MP, told journalists outside Griveaux’s campaign headquarters that the candidate had made the decision to stand down alone.

“It’s the decision of a free man. It’s his decision,” she said. “La République en Marche is strong. La République en Marche is still here. We will not let Paris go.”