A Malaysian diplomat has been sentenced to nine months of home detention in New Zealand after pleading guilty to indecently assaulting a woman.

Mohammed Rizalman bin Ismail was a military attache at Malaysia's Wellington embassy when the incident took place in May 2014.

The police said Rizalman went to the home of Wellington woman Tania Billingsley and entered the house without her knowledge. He then walked into her bedroom naked waist down, hoping to make her agree to sex.

He was arrested after the woman escaped from the room and called the police. However, he returned to Malaysia under diplomatic immunity.

Rizalman was then extradited back to New Zealand in November 2014 when he pleaded guilty to the charges.

Judge David Collins observed that Rizalman had a history of strange behaviour and was hitting on women after reaching New Zealand.

"She leapt from her bed and screamed at you to get out ... You then approached Ms. Billingsley and grabbed her shoulder," the judge said.

Though the judge concluded that Rizalman's actions were "premeditated", he said the defendant did not touch the victim in a sexual way.

The judge said Rizalman will be detained in a Wellington rental home and will be deported to Malaysia at end of his sentence.