Their aim was to fit a tracking device to a car linked to a suspected P cook. But just before Sergeant Don Wilkinson and a colleague could carry out their task, a light, triggered by sensor, flicked on.

The undercover officers then heard a deadbolt on the front door of the target house unlock. More security lights came on and flooded the whole area with light. Mr Wilkinson and the colleague, whose name is suppressed and can only be known as Officer M, turned and fled down the road.

Yesterday, Officer M told an Auckland court that he knew their target was a larger man so "wouldn't be able to chase us down the road".

It wasn't until they reached the corner of Hain Ave and Earlsworth Rd in Mangere East that they heard a high-performance car start at the address and begin to follow them.

Mr Wilkinson was shot and killed in the attack that followed, on September 11, 2008. Officer M was shot too, but survived.

The Crown alleges the killers are John Ward Skinner, 37, and Iain Lindsay Clegg, 37. They are on trial in the High Court at Auckland accused of murdering Mr Wilkinson and the attempted murder of Officer M.

Skinner is also charged with assault with a firearm.

Officer M, giving evidence in a court closed to the general public, said he followed Mr Wilkinson down the driveway of a house in Earlsworth Rd as the car drove past. It stopped and reversed back to where they were. Both men had dropped the bags they were carrying. Officer M radioed for help, saying they were "in trouble".

He held his hands up as the driver got out and walked towards him, stopping about 2m away.

The passenger emerged from the car too - with a firearm held at chest height.

Officer M held his hand up instinctively in defence and was shot through the forearm. The bullet passed though his arm and hit him in the chest and he fell to the ground.

"The next thing I remember is being shot in the back."

He next heard three quick shots and the sound of the car leaving. "I could hear Don gurgling and groaning. I turned to talk to him, to ask what happened, to see if he was all right. But I never got a reply at all."

Earlier, the court heard that before a crime scene examination occurred, a senior police officer, Officer W, had taken the backpacks belonging to Mr Wilkinson and Officer M from where they had been dropped.

Officer W told Skinner's lawyer, Kevin Brosnahan, he removed the bags because if their contents became known, it could have "national or even international ramifications".