Massachusetts State Police identified the deceased as Sean Gannon, an officer from the Yarmouth Police Department.
He was ordered held without bail and a probable cause hearing was set for June 26.
Nero, said Xiarhos, is under around-the-clock law enforcement protection and "will remain in the care and control of the Yarmouth Police Department".
Thomas M. Latanowich, 29, of Somerville, was taken into custody about an hour after the shooting and will be arraigned and charged with murder for Gannon's killing, said Cape and Islands District Attorney Michael O'Keefe.
Latanowich entered the court with his head down. "He's gone. He died doing what he loved".
"We will, together, get through this, and we plan to keep Sean's memory alive, and I hope that everybody out there appreciates the work that police officers across the country do every day", he said Thursday night.
Trump, Gardner Strike Marijuana Deal After Sessions Memo Fallout
Cory Gardner said Trump promised him over the phone Wednesday that a memo Sessions issued a year ago won't affect his home state. Gardner met with Sessions in January shortly after that, but no discernible actions came from the meeting.
The officer shot and killed Thursday in Barnstable was a New Bedford native.
Shaughnessy said the school will create a memorial for Gannon on school grounds.
Gannon's K-9 partner, Nero, was wounded.
Yarmouth's state Rep. Tim Whelan, previously a state police sergeant, and had worked at the Yarmouth barracks, knew Gannon personally.
The loss of Gannon has stunned the picturesque community of Yarmouth, right next to Barnstable.
Police, including the K-9 team, had gone to the house to arrest Latanowich, who was wanted on a prior charge and was considered risky.