A pervert with a penchant for pastry has been jailed and banned from central Palmerston North after he was caught masturbating outside an inner-city bakery.

Steven Karu, 41, was also ordered to attend a habitual sexual offenders programme, after he was busted peering through a Broadway Ave bakery window at female workers, while "stimulating his genitalia".

Karu appeared in the Palmerston North District Court yesterday to be sentenced on a charge of indecent behaviour in a public place.

In his sentencing summary, Judge Alistair Garland told the court how a bakery worker noticed Karu looking in, with his right hand "moving furiously'' down his pants in the early hours of the morning on November 11 last year.

One of the workers went outside to confront him, before telling Karu to go away.

Less than two hours later, Karu sat on a bench outside the bakery, and exposed himself and began masturbating again in front of two female bakery workers.

Karu had already racked up more than 180 convictions dating as far back 1993, with 29 of them being of a sexual nature.

Judge Garland said these included possession of objectionable material and obscene use of a telephone, but he noted Karu had not progressed to physically touching his victims - just himself.

While Karu offered an apology in court, saying "I do have remorse to my victims, and I show deep sympathy towards them, and I'm sorry for what I've done", Judge Garland dismissed the apology, saying the volume of his sexual offending suggested otherwise.

"Your offending is serious given the brazen nature of your conduct, without any concern for the victims. You are a selfish, self-indulgent person who is quite manipulative."

He then ordered Karu to a year's imprisonment, to undergo treatment for habitual sexual offending and "not to enter the central business district as defined by the liquor ban area''.

He did not put a timeframe on the ban.

Karu will serve his sentence cumulatively, on top of one he is already serving, which is due to expire in June.

He has been ordered to undergo a psychiatric assessment and attend the "Will Stop" adult sexual offending treatment programme as well as drug and alcohol assessments.