Governor Charlie Baker restated his longtime support of the death penalty for the killing of police officers, following the death of Yarmouth Police Officer Sean Gannon.

“This guy was everything you would want in a friend, a neighbor, a brother, an officer, a person,” Baker said during an interview with Boston Public Radio Thursday. “And to have, on the serving of a warrant, to have him shot and killed by a guy who was just the opposite in so many ways — just makes a lot of people, including me, angry.”

Gannon, 32, was a beloved figure in the Cape Cod town where he had served as an officer for eight years before he was fatally shot last Thursday. Gannon was killed while serving an arrest warrant at the home of Thomas Latanowich, a criminal with multiple arrest charges and a history of domestic violence. In a sweep of Latanowich’s house, Gannon was shot in the head and died.

“Sean Gannon got shot and killed because he walked up a flight of stairs and turned a corner,” Baker said. “I’ve said for many years that I would support the death penalty for the assassination of a police officer. And I’ve said it because I think they put themselves in positions that most of the rest of us can’t even begin to understand.”

Massachusetts last executed a criminal in 1947 and abolished capital punishment in 1984.

Baker compared the Gannon case to the 2016 death of Auburn Officer Ronald Tarentino Jr., who was shot and killed during a traffic stop by a man with a long history of crime.

“In the case of Tarentino,” Baker said, “we went back and did a pretty heavy look at all the information associated with what happened in that case and concluded that we needed to tighten up assault and battery of a police officer with intent to injury.”

Baker signed a major overhaul of the state’s criminal justice system last Friday, a bill that he says would have impacted the Tarentino case. “He had three misdemeanors in a row, one of which…was a domestic violence issue, which was treated as a misdemeanor,” Baker said, referring to Tarentino’s killer, Jorge Zambrano. “And we filed legislation to up the ante on assault and battery of a police officer with injury, and the criminal justice bill that got signed last week made that a felony.”

“Now hopefully in the future,” Baker continued, “if somebody is literally the kind of person who is perfectly happy to take on police officers and to hurt them, that crime will be treated more appropriately and that person won’t be on the street.”