During an argument a man threw a brick at the wrong car, a court was told.
Scott Bannister pleaded guilty in Whanganui District Court on Tuesday to one charge of wilful damage.
Police prosecutor Rachel Willemsen told the court at 10pm on December 17 witnesses saw Bannister pick up a brick and throw it at car parked on the side of the road, smashing a window.
When arrested by police he said he threw the brick because people were egging him on.
His lawyer Richard Leith told the court Bannister had just been in argument with his ex-partner and her new boyfriend.
He thought the car belonged to someone else and was "completely sorry" for what he had done.
Judge Philip Crayton said Bannister's actions had caused emotional suffering for the victim, who had parked their car on the side of the road in order to help a pedestrian.
He was sentenced to 120 hours community work ordered to pay $325 to the victim for damages and $250 in reparations for their emotional suffering.
Before he left the court Bannister said he just wanted the Judge to know he turned himself in, he hadn't been tracked down.