A man slapped President Emmanuel Macron in the face on Tuesday during a walkabout in southern France.
Macron later said he had not feared for his safety, and that nothing would stop him carrying on with his job.
In a video circulating on social media, Macron reached out his hand to greet a man in a small crowd of onlookers standing behind a metal barrier as he visited a professional training college for the hospitality industry.
The man, who was dressed in a khaki T-shirt, then shouted "Down with Macronia" ("A Bas La Macronie") and slapped Macron on the left side of his face.
He could also be heard shouting "Montjoie Saint Denis", the battle cry of the French army when the country was still a monarchy.
Two of Macron's security detail tackled the man in the T-shirt, and another ushered Macron away. Another video posted on Twitter showed that the president, a few seconds later, returned to the line of onlookers and resumed shaking hands.
The local mayor, Xavier Angeli, told franceinfo radio that Macron urged his security to "leave him, leave him" as the offender was being held to the ground.
Two people were arrested, a police source told Reuters. The identify of the man who slapped Macron, and his motives, were unclear.
The slogan the man shouted has been co-opted in the past few years by royalists and people on the far-right in France, Fiametta Venner, a political scientist who studies French extremists, told broadcaster BFMTV.
Macron was on a visit to the Drome region to meet restaurateurs and students and talk about returning to a normal life after the Covid-19 pandemic.
It was one of a series of visits he is making, his aides say, to take the nation's pulse before a presidential election next year. He later continued his visit to the region.
Macron, a former investment banker, is accused by his opponents of being a part of a moneyed elite aloof from the concerns of ordinary citizens.
In part to counter those allegations, he on occasion seeks out close contact with voters in impromptu situations, but this can throw up challenges for his security detail.
Footage at the start of Tuesday's slapping incident showed Macron jogging over to the barrier where the onlookers were waiting, leaving his security detail struggling to keep up. When the slap happened, two of the security detail were at his side, but two others had only just caught up.
In an interview with the Dauphine Libere newspaper after the attack, Macron said: "You cannot have violence, or hate, either in speech or actions. Otherwise, it's democracy itself that is threatened."
"Let us not allow isolated events, ultraviolent individuals... to take over the public debate: they don't deserve it."
Macron said he had not feared for his safety, and had continued shaking hands with members of the public after he was struck. "I kept going, and I will keep going. Nothing will stop me," he said.
In 2016, Macron, who was economy minister at the time, was pelted with eggs by hard-left trade unionists during a strike against labour reforms. Macron described that incident as "par for the course" and said it would not curb his determination.
Two years later, anti-government "yellow vest" protesters heckled and booed Macron in an incident that government allies said left the president shaken.