PARIS — The French health minister, Agnes Buzyn, was named as a new candidate for mayor of Paris on Sunday, after a scramble to replace the original contender, who abruptly withdrew after a leak of sex videos on social media.

The choice of Ms. Buzyn came just two days after a frantic search for a candidate began, underscoring the importance that President Emmanuel Macron’s centrist party places on winning the mayor’s office — and emerging from a scandal.

Benjamin Griveaux withdrew from the mayoral race after explicit videos began circulating on social media, a leak operation claimed by a controversial Russian performance artist, Piotr Pavlensky. Mr. Pavlensky and his girlfriend were being questioned by police investigators over the weekend on counts of invasion of privacy and diffusing images of a sexual character without permission.

In claiming responsibility for the leak of the sexual videos, Mr. Pavlensky denounced the “big hypocrisy” of Mr. Griveaux, a married father of three who put family at the forefront of his campaign.