Const. Mathieu Brassard, testifying Thursday at a coroner's inquest being held in Montreal to look into the death of the 41-year-old Magloire, grew emotional as he described how he took aim and fired until he felt the threat was over.
Brassard fired four shots.
The officer said when he and his partner, Pascal Joly, arrived at the scene, he realized it was not an ordinary call.
In his testimony, Brassard described in detail how he and his partner, and two officers who had arrived before them, approached Magloire near Montreal's downtown bus terminal.
He said the officers were yelling at Magloire to drop a hammer he was holding.
The fact that he didn't meant Magloire was in an "attack position," Brassard testified.
The officer described how Joly tried to tackle Magloire. He said he was in the process of lowering his weapon to help Joly, but saw that Magloire was poised above his partner, ready to strike him with the hammer.
Brassard said he knew he had to save the life of his partner, so he fired. It all took about a tenth of a second, he said.
Brassard said the police car that struck Magloire was intended as a diversionary tactic, aimed at gaining a few more seconds.
He said it might have worked had it hit him a bit harder.
Brassard is the fourth officer to testify at the inquiry. Joly appeared on Wednesday.
The inquiry began on Monday and is expected to last two weeks. It aims to determine the circumstances around Magloire's death.
Another session in March will look at social and medical assistance, and help available to people with mental health issues.