Disgraced Malaysian Embassy worker Muhammad Rizalman had a sexual motive when he followed a Wellington woman home, defecated outside her house and then walked in and indecently assaulted her.
The 39-year-old has admitted believing in black magic, smoking cannabis and buying legal highs.
But he said on May 9 last year, he followed Tania Billingsley home only because she had given him a look he took as an invitation.
Rizalman claimed he was simply going to discuss his problems with her.
He admitted defecating outside her house, saying it was a case of emergency diarrhoea. He then walked into Ms Billingsley's house - with no pants or underwear on - to clean himself up, he said.
However, the Crown said there was a sexual motive and suggested Rizalman was trying to cast a love spell on Ms Billingsley in leaving the faeces on her patio.
It also said he'd followed another woman the day before and made a pass at a shop worker when he bought legal highs.
Rizalman argued he was suffering mental illness at the time, something the Crown disputed.
The disgraced former assistant to Malaysia's defence attache admitted a charge of indecent assault, on the basis there was a scuffle between the pair and it was indecent because he was semi naked.
But he disputed aspects of the Crown case against him in an extraordinary hearing held over two days this month in the High Court at Wellington.
Today Justice David Collins released his decision, siding with the Crown arguments about Rizalman.
"Mr Rizalman had a sexual motive when he followed Ms Billingsley to her home on the evening on May 9, 2014, and when he entered her bedroom naked from the waist down," Justice Collins said.
"Mr Rizalman may have had 'diminished understanding' at the time he indecently assaulted Ms Billingsley. However, Mr Rizalman's possible 'diminished understanding' is not a mitigating factor because at the time of his offending Mr Rizalman was, in all likelihood, affected by synthetic cannabis."
Rizalman is due to be sentenced next year and Justice Collins said he would hold a discharge without conviction hearing in February, if Rizalman was still applying for that.
The judge has ordered a pre-sentence report and a report to assess Rizalman's suitability for home detention, which could be served at the Malaysian High Commission.
Justice Collins asked the Ministry of Foreign Affairs and Trade to forward a copy of his decision to the Malaysian High Commission to see if it was willing.
A Crown summary says when Rizalman entered Ms Billingsley's flat, she was sitting on her bed, fully clothed, watching a movie on her laptop.
After he went into her room, the pair scuffled and she forced him out of the house and called police.
Initially, Rizalman told officers the pair had met at a cinema and she invited him home, but she became angry when he ate her food.
Court documents released to NZME also revealed Rizalman blamed his Wellington appointment, which began in 2013, for stressing him out.
University of Auckland professor of psychiatry Graham Mellsop interviewed Rizalman last month and his report was submitted to the court.
"His major concern was that there was an element of corruption by his superiors with which he, as an underling, had to comply," the report said.
"It was, he said, immoral. So he had not wanted to comply, but felt that he had to obey the orders of superiors.
"He became stressed, developed headaches, the excessive sleepiness and the forgetfulness described in his statement."
Nobody at the Malaysian High Commission has been available for comment since NZME began making inquiries last week.