A 33-year-old French man was sent to prison on Thursday after phoning and texting his ex-girlfriend 21,807 times, admitting that, with hindsight, "it was stupid".
The unnamed defendant, who had made the calls to demand the woman thank him for fixing up their flat, was given a 10-month sentence -- six months of which was suspended -- and a 1,000-euro ($1,300) fine.
He will also have to undergo psychiatric treatment and is barred from all contact with the woman he harassed, lawyers in the case told AFP.
The defendant, who comes from Rhone in southern France, had already accepted responsibility for the barrage of phone calls and text messages over a 10-month period, and had accepted an earlier demand to cease contact with his ex.
He had been hospitalised in the past for depression, and struggled to cope when his girlfriend broke off their relationship in 2011. He demanded compensation for work he had carried out in their apartment.
"At the time, my logic was that until she returns the money ... or at least says thank you, I would not stop the calls," he told the court in Lyon.
The calls kept coming -- averaging more than 73 per day.
"She tried to block her line, but he phoned her parents instead and her workplace," said Manuella Spee, lawyer for the victim, a 32-year-old teacher who was also not named.
It was only when she finally said thank you, during a meeting organised by a mediator, that the harassment stopped. He has not contacted her since.
"I tell myself, with hindsight, that it was stupid," he told the court on Thursday.
He said he wanted to return to school to train to be a legal assistant, and added that he had a "passion for writing".