A police prosecutor who sold methamphetamine during his lunch break and passed secret information from police files to his drug dealer has spoken for the first time about why he chose to break the law.

Timothy John Russell Sarah was an Auckland District Court prosecutor who was arrested when police cracked a drug ring in 2011, laying drugs charges against 22 people.

The 37-year-old was yesterday jailed for four years after pleading guilty to five charges, including supplying methamphetamine and dishonestly accessing the police intelligence computer system to get confidential information.

In an interview with the Weekend Herald before the sentencing, Sarah claimed that seeing a woman set herself on fire after he successfully opposed bail for her partner had triggered nightmares so intense he didn't want to sleep. And that quickly led to dealing drugs.

"I didn't wake up one morning and decide to give the middle finger to the law," he said. "There was a set of circumstances where I was vulnerable ... but I can't blame that - I was still able to make decisions."

His former colleagues feel shocked and betrayed. One former workmate, speaking on condition of anonymity, spoke of the high level of trust among prosecutors.

"To now have the knowledge of what his actions were ... A lot of people used to socialise with him."

Sarah arranged one drug deal from inside the Auckland District Court, and sold methamphetamine during his lunch break.

"I used to go to lunch with him," said the workmate, "and a lot of people went to lunch with him and he would sometimes just wander off."

Sarah, who represented the police in rugby, told the Weekend Herald he began using the drug speed, which is methamphetamine heavily cut with glucose and caffeine, as a stimulant to help him at the gym.

Later, he used it to help deal with the stress disorder he developed after watching the woman burning.

"Truth be known, I didn't want to sleep after what had happened. When you're having nightmares, you don't feel like sleeping."

He had other difficulties and he felt he couldn't ask for help.

"I was struggling with stuff, but I thought I've got to keep sucking it up and hope it goes away."

That led to selling drugs to friends, which he justified as "doing more good than bad".

"But when you cross the moral barrier where you justify something for yourself, it's a short step to, 'Is there any problem with me grabbing some for a mate?' as well."

Intercepted phone conversations led police to conclude that Sarah dealt 21g of P to nine people over two years.

Justice Kit Toogood described the hypocrisy and cynicism of his actions as "breathtaking", and Crown prosecutor Robin McCoubrey said the offending had tarnished the reputation of the police.

"As he sat in the district court, no doubt prosecuting drug offenders, he was arranging a drug deal, and in the court break, he concluded the drug deal. In the Crown's submission, that goes beyond hypocrisy."

Sarah accessed the police intelligence computer more than 80 times and searched for information on people connected to his drug dealer.

Details of the help he gave criminal associates was revealed at his sentencing.

On one occasion, he warned the drug dealer that one of his friends should not be spoken to because police were watching him.

He also sent a warning to another man, advising him to leave Auckland.

Another time, Sarah told his drug dealer he would wait for one of his colleagues to leave their desk so he could check the police computer using their log-on.

The judge said: "The point is, Mr Sarah, you accessed the computer for whatever information you could find for the benefit of your drug-dealing friends."

Sarah's lawyer, Ron Mansfield, said his client was sorry for what occurred, and he asked the judge to keep in mind that the methamphetamine was heavily cut and only 5 per cent pure - compared with P, which was usually 70 per cent.

Sarah had undergone counselling and had made efforts to rehabilitate himself, Mr Mansfield said, and he asked Justice Toogood to consider a sentence of home detention.

But the judge rejected this, saying: "It does not adequately reflect your disgraceful nature, which has brought you here."

Sarah's offending had breached the trust of the public and his colleagues, Justice Toogood said.

He took time off Sarah's sentence for his early guilty plea and the fact that he had done voluntary community work and sought help for his drug problem.

Asked outside court how Sarah would cope with prison life, Mr Mansfield said everyone would appreciate the strain on his client.

He said the Corrections Department was familiar with the case and would "appreciate that there is a potential for him to be a target".

Sarah is expected to receive some form of protection, such as placement in a secure unit mainly used to protect sex offenders.

Corrections declined to comment on what it does for prisoners who could face threats.

The head of the investigation, Detective Senior Sergeant Lloyd Schmid, said police would not tolerate criminal behaviour by their own staff.

"Criminal offending by police staff is not only unacceptable, but it is also extremely disappointing for other staff and the organisation as a whole."