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.
Justice Department inspector general says McCabe repeatedly mislead
DOJ says it was taking its lead from the FBI's Office of Professional Responsibility recommending McCabe be sacked. McCabe previously drew attention for his misbehavior regarding the investigation into Hillary Clinton's emails.
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.