The suspect accused of fatally shooting a Massachusetts police officer on Thursday while he was being served a warrant had 111 prior adult offenses and was on probation, authorities said.

Tom Latanowich, 29, of Somerville, Mass., will be charged with murder, police said. Massachusetts State Police identified the deceased as Sean Gannon, an officer from the Yarmouth Police Department.

The K-9 officer died after he was shot in the head, a police source told Fox 25 Boston. He was serving the warrant in the town of Barnstable.

"We are also praying tonight for the recovery of Officer Gannon's K9 partner, who was also injured in today's tragic incident," state police said in a statement.

Latanowich has a long history of run-ins with law enforcement and was linked to 111 prior criminal charges, police said in a Facebook post.

The shooting unfolded around 3:30 p.m. while the officer, who was with two state troopers, was serving a warrant, Fox 25 Boston reported.

The officer was rushed to a local hospital where he died, Boston 25 reported.

The suspect had been barricaded in the home for hours before finally surrendering to law enforcement.

Massachusetts Gov. Charlie Baker tweeted that he was "heartbroken" after hearing about the officer's death and said his thoughts and prayers were with Gannon's "family, loved ones and the @yarmouthpolice after this tragic loss."

"MA is blessed to have courageous men & women who put their lives on the line to protect our communities every day," he continued.

The Boston Herald reported that police cruisers drove with their lights flashing as his body was transported from the hospital to the medical examiner’s office.

The Associated Press contributed to this report.

The Associated Press contributed to this report.