He said the incident had left the officers fearing for their safety, but it would not have happened if Matua Baker had complied with officers when they went to arrest him over a minor domestic issue.
''Your bad behaviour caused this,'' the judge said.
Judge Tomlinson told Matua Baker that if he lived in any other country in the world, apart from the UK, he or his brother would have been shot dead by police that day.
"The moment anybody points a gun at cops [in those countries], the first thing that happens is you get shot," he said.
"Clearly and firmly in the back of my mind is the fear that the police had that day."
On the day in question when police turned up to arrest him over damage he caused to his father's car, Matua Baker initially ran away, but when the officers came back later the same day, he squared up to an officer and raised his fists.
The officer got him on the ground and used an extendable baton to hit him across the back. Then, out of concern for his brother, Henare Baker came onto the deck of their parents' house and pointed an air rifle at police. Matua Baker then urged him to "just f****** shoot them", Judge Tomlinson said.
The judge said the officers thought it was a firearm and it caused immediate and genuine concern for their lives.
Police managed to use pepper spray to restrain Matua Baker, and he then spat into an officer's face, which the judge said he found to be a disgusting act.
As he was being led away in handcuffs, Matua Baker kicked an officer in the ankle, causing them to fall on the ground with several police falling on top of him.
This led Henare Baker to pick up a spade, but he put it down when police presented a Taser at him.
Despite Matua Baker's actions that day, Judge Tomlinson said while he needed to discourage dangerous actions against police, he did not want to send Matua Baker to jail, which would likely ruin his life.
"Sentencing you to jail would be throwing your life away and pushing you into a life of gangs. Sending you to jail would be unbelievably counterproductive, not just for you but for the community in the long term."
The judge said Matua Baker was intelligent - though he may not think so and he may never have been told he was - and he now needed to take the opportunity given to him, instead of holding onto anger from a difficult upbringing.
Matua Baker was taken into state care at 6 months old and didn't return to his family until he was aged 7 and the judge said he had had a terrible time in care, which may be behind his attitude problem and his "anti-authority, anti-police, anti-society" thoughts that left him with a chip on his shoulder.
''[Imprisonment] will leave you at the mercy of the gangs and they will just scoop you up, and I will be dealing with you for the next 20-30 years, and your life will be ruined.''
He sentenced Matua Baker to 10 months' home detention, with six months' special post-detention conditions and 16 months' judicial monitoring. He also disqualified him from driving for six months.
Judge Tomlinson said the judicial monitoring meant he would get a report from Matua Baker's probation officer every three months and if he was not complying with what was expected then he could be brought back to the court and re-sentenced.
''And that will only mean jail,'' he said.