At the High Court in Christchurch, prosecutor Mitchell McClenaghan outlined the Crown's case against Ma'anaiama and his alleged "brazen and dangerous actions".
Dog handler Constable Kurt Stephenson was patrolling Breezes Rd in the Aranui area of the city at around 7.20pm on February 26 when he spotted a black Holden Executive car which matched a description of a vehicle wanted by police for a shooting incident three days earlier.
But as he approached, a person appeared from the back seat, got behind the wheel, and a police pursuit followed.
While Stephenson related information back to police communications, Senior Sergeant Craig Scott laid road spikes at the QEII Drive and Marshlands Rd intersection.
But as the driver approached, he allegedly swerved towards Scott who was on the roadside laying the spikes and "attempted to strike him with the vehicle".
After the narrow miss, the car's tyres were punctured but did not stop the driver, who continued to evade police, talking on a cellphone, the court heard.
As he passed the Palms Shopping Mall, Stephenson says he saw the driver grab a shotgun and point it out of the driver's side window.
A tyre came off the rim as the Holden pulled into Evelyn Couzins Ave - a dead-end street. It was still light on a summer's evening, with members of the public outside, the court heard.
The car came to a stop, the police say, and the driver jumped out of the car.
Stephenson pulled up about 25m away, when he says the driver faced him, with what he thought was a pump-action shotgun held in both hands about waist height.
With the muzzle "pointed directly at me", the police officer said he "immediately feared for the safety of myself and for members of the public in the area".
As the male walked a wide arc with the gun allegedly pointed at Stephenson, he got out of his police car and sought cover behind it, withdrawing his police-issue Glock pistol, racking the slide and chambering a 9mm round from the magazine into the firing chamber.
He yelled as loudly as he could, "Armed police, drop the weapon."
The man did not respond, Stephenson said, and moved behind the vehicle, emerging on the other side, still pointing the shotgun at him.
Stephenson says a shot was fired directly at him, saying he heard the explosion of the gunshot, following by the noise of shotgun pellets being fired in his direction. He said the "distinctive whistle sounds" were like nothing he's ever heard before.
He told the jury he believed the shooter was trying to kill him.
Stephenson fired "a number of rounds" from his Glock back at the gunman but didn't think he hit him.
By then, other police officers had arrived – a total of five police officers in four police vehicles.
As the gunman again aimed the muzzle of his shotgun at Stephenson, the jury heard that the officer fired his Glock at him until he was incapacitated.
He saw his legs bend and fall down on one side, with the shotgun nearby.
While officers covered the shot man with Glocks and Bushmaster rifles, Stephenson commanded his police dog Mint to rouse, biting him on the upper right arm.
Ma'anaiama was arrested at the scene and, after receiving first-aid treatment, taken to Christchurch Hospital.
A police examination of the scene found shotgun pellet dents in the grille of Stephenson's police car and a shotgun pellet in its radiator. Further shotgun pellets were found down the length of the street.
Officers also found two shotgun shells at the scene, the court heard.
A total of 35 shots had been fired by police officers.
A local resident filmed part of the incident on his cellphone. The dramatic footage, featuring multiple loud gunshots and sirens wailing, was twice played to the jury today.
The Crown says the clip shows Ma'anaiama taking aim directly at Stephenson and another police officer.
Ma'anaiama denies seven charges, including two of attempted murder, assault with a weapon, two charges of using a firearm against a law enforcement officer, and two alternative charges of using a firearm against a law enforcement officer.
Defence counsel Rupert Glover urged the jury to keep an open mind and not be fooled by the Crown's "confident" opening address as they haven't yet heard the whole story.
The trial's second witness, Sergeant Brett Neal, who joined the police chase just behind colleague Stephenson, says he also shot at Ma'anaiama.
As they stopped in Eveleyn Couzins Ave, Neal claims the fleeing driver raised a shotgun to his shoulder and took two shots at them both.
He recalled a muzzle flash, puff of smoke, and thought he was going to be hit.
Neal felt he had no option but to return fire, sending the driver ducking behind his car. Neal thought he was perhaps reloading.
When he emerged again with the gun directed at them, Neal said he opened fire until he went down.
Cautiously, he approached the fallen man along the cover of a tree line with his Glock drawn. Lying bleeding on the ground, Ma'anaiama saw him and put his hands up, the court heard.
Neal saw a bullet hole in Ma'anaiama's right shoulder and started applying pressure to the wound.
Defence lawyer Glover questioned Neal over just how many shots had been fired by Ma'anaiama.
After the court heard Stephenson's recollection that just one shot had been fired, fellow officer Neal recalled two shots.
Glover then went over his evidence, where Neal says he thinks the alleged gunman had fired two shots at them, but then went on to say the male fired another shot in their direction, making three shots.
Then later, Neal has a memory of a "volley of shots" when the man is shooting at police who were returning fire. He accepted Glover's point that it would've meant the gunman fired at least four shots.
In re-examination where McClenaghan asked how quickly the incident had unfolded, Neal replied: "About 10 seconds, if that. It was pretty quick."
The trial, which continues before Justice Cameron Mander, is expected to last all week and hear evidence from 17 witnesses.