A US judge has forced a court defendant to write 144 nice things about his former girlfriend.

The unusual punishment was handed down after the accused pleaded guilty to violating a protection order issued by his former partner. Daren Young, 30, admitted contacting or attempting to contact the woman over 144 times over a three-hour period earlier this year.

This prompted Judge Rhonda Loo to issue her unconventional ruling:

"For every nasty thing you said about her, you're going to say a nice thing," Loo told Young. "No repeating words," she said.

Young was initially ordered to stay away from the woman following a case on February 22 of this year but contacted her with the harassing messages two months later. Mr Young was ordered to serve 200 hours of community service as well as two year probation on top of time served.

"It's so childish to think a grown man can be so thumb-happy,"

"I don't know whether I should cut off your fingers or take away your phone to get you to stop texting," Loo told Young. "You probably shouldn't get a phone, period. I hope she changed her number."

Mr Young has promised to obey the ruling and told the judge he now wants to move on with his life.

This is not the first time a court has handed down an unconventional sentence. An Oregon court of appeal ordered a family to 'debark' their dogs following years of complaints by neigbours.

Debarking involves surgically modifying or removing a dog's vocal chords. The US National Animal Interest Alliance describes it as a way "to lower the volume of the dog's bark and the ability of the bark to carry over a wide area."