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.