Witnesses who gave evidence against a man accused of shooting a police officer lied to cover up for what really happened, the High Court in Auckland was told today.

Neshanderan Rajgopaul, 29, is on trial for attempting to murder Constable Jeremy Snow in Papatoetoe in December 2009.

Mr Snow was shot four times when he and his partner stopped to check a car in a driveway of a house they believed was being broken into.

He was rescued by armed police as he came close to dying from blood loss.

Opening the defence case lawyer Ron Mansfield said police had taken the view that Rajgopaul was the only one who could have carried out the shooting.

But there were two men hiding in the backyard that night, he told the jury.

Mr Mansfield said Rajgopaul's associates Darrin Court and Gavin Lomas had lied when giving evidence to protect Mr Court, who was the real shooter.

"I suggest there's a code amongst criminals which has dictated the evidence you've heard," Mr Mansfield said.

The Crown today discharged Rajgopaul on one charge of threatening to kill, because of insufficient evidence.

As well as the attempted murder charge, Rajgopaul is being tried on one of firing a weapon with intent to cause grievous bodily harm, four of unlawfully possessing a firearm, and one each of possessing a class A drug for supply and receiving stolen property.

He also faces two charges of assault using a firearm as a weapon relating to incidents between September and December 2009. He has pleaded not guilty to all 10 charges before the jury of six men and six women.

The trial is into its fourth week.