Disgraced Hamilton police officer Robert Hansen was sentenced Thursday to five years in prison, after he was convicted of three charges related to a 2012 incident where a gun was planted in a suspect's home.

Superior Court Justice Catrina Braid said Hansen's actions took the goal of making Hamilton's streets safe into his own hands.

"His conduct was a form of vigilante justice," she said, in delivering the sentence.

Braid issued a sharp rebuke to Hansen's behaviour, demonstrated in text messages exchanged in May 2012 between Hansen and someone he thought would plant a gun at a suspected drug trafficker's house.

Hansen: "He could use some jail time. Do u you have any ideas how to get him?"

Source: "you keep him away from my girl by locking him up if you can do that I'll set him up for you"

"I'll let you guys get him with a thing"

Hansen: "This will get him put away for several years"

"I will help u fuck these guys up"

When the source expressed reluctance a few days later, Hansen encouraged him to persevere, and even talked about other "set ups" in the future.

Hansen: "It would help tons. Especially that heat."

His conduct was a form of vigilante justice. - Superior Court Justice Catrina Braid

Braid said Hansen abused a position of trust.

"Rather than investigating crime and putting legitimate evidence before the courts to determine a just outcome, Hansen took the goal of keeping the streets safe into his own hands," she said.

At the time Hansen was suspended and charged, he was a detective constable with the service's high-profile and impressive guns-and-gangs unit. He joined the service in 2000.

Hansen was found guilty in January of perjury and two counts of obstruction of justice related to the 2012 gun-planting incident.

He lied on the application to search the suspected drug dealer's house, making a false statement about the gun, and left other material things out, like that the gun hadn't just been in the trafficker's house but had actually been planted there to be used as evidence – on Hansen's urging. Then he made a false statement under oath to secure the warrant.

He plans to appeal both the conviction and the sentence.

'It is difficult to imagine activity that could have a more damaging effect'

The wrongdoing doesn't just affect the case against the suspected drug dealer whose house was the planned target of the planted gun, Braid said.

Ten drug prosecutions were terminated after he was charged.

"Hansen's conduct calls into question the integrity of other prosecutions in which he played a pivotal role," Braid said.

She admitted that Hansen's record was otherwise "unblemished" but said his misconduct undermines public confidence in the police.

"While it is true that his career has been untarnished to this point, it is difficult to imagine activity that could have a more damaging effect on the reputation of the Hamilton Police Service and the public's trust in the hardworking officers who patrol the streets."

Now suspended without pay

The sentence closes a chapter on a four-year legal process, during which Hansen, 41, has been suspended from work, but paid his salary in the meantime. He was listed on the Ontario Sunshine List as earning $103,370.49 last year.

His suspension and that of his guns-and-gangs unit colleague, Craig Ruthowsky, have been cited as particularly egregious as former Chief Glenn De Caire lobbied for the ability to suspend officers without pay.

As of hearing the sentence, Hamilton Police Service Chief Eric Girt invoked Police Services Act powers to suspend the officer without pay, effective immediately.

He remains a Hamilton Police officer as of Thursday, according to his defence attorney, Bernard Cummins. Hansen was taken into custody after the decision and will remain in custody pending his appeal next week, Cummins said.

Crown attorneys Peter Scrutton and Molly Flanagan had asked the judge Tuesday to issue a sentence of six years in jail as a strong message of "denunciation and deterrent" for any law enforcement officers tempted to act similarly. Cummins had said no more than 16 months was necessary.

'He has only himself to blame'

Members of Hansen's family in court on Thursday appeared stone-faced and declined to comment after the sentence was announced. Hansen has been married for 12 years and has two kids aged 10 and 8.

Cummins said that the family had been prepared for jail time as a mandatory component of a sentence for perjury, but the impact of Braid's decision emboldens Hansen's defence team, Cummins said.

"This has a devastating impact on his family life but that just strengthens our resolve to see if we can hear this at the court of appeal," he said.

Attorney Peter Scrutton, for the Crown, agreed on Tuesday that Hansen's family would suffer if he went to jail and lost his job.

"But this is because he committed a very serious offence, and breach of trust," Scrutton said.

"And he has only himself to blame for that."

kelly.bennett@cbc.ca | @kellyrbennett