A court has ordered the man who slapped French President Emmanuel Macron across the face to serve four months in jail, news channel BFM TV reported.

The court gave Damien Tarel, 28, a fan of medieval swordsmanship and martial arts, a sentence of 18 months in jail, but 14 of those months were suspended, the broadcaster reported.

Earlier, Tarel told the court in Valence in southern France, that he was a right-wing sympathiser who acted because the president stood for all that was rotten with France, the TV channel said.

Tarel attacked Mr Macron when the French president was shaking hands with members of the public during a walkabout in France's Drome region.

The accused said that, several days ahead of the president's visit to the region, he had thought about throwing an egg or a cream tart at him, but added that the slap was not premeditated.

"I think that Macron represents very neatly the decay of our country," he told the court, according to BFM TV.

"If I had challenged Macron to a duel at sunrise, I doubt he would have responded."

Mr Macron has described the attack as an isolated incident and said violence and hate were a threat to democracy.

His office did not respond to a request for comment on Tarel's courtroom remarks.

Tarel faced a charge of assault against a public official, an offence that carries a maximum sentence of three years in jail and a €45,000 fine.