Ape, a 2-year-old FBI dog was killed in a firefight on Thursday morning.

On Wednesday, Kurt Myers killed four people in seemingly random shootings in the upstate New York towns of Herkimer and Mohawk. By Thursday morning, he had barricaded himself inside an abandoned bar in the town. When Ape was sent in to survey the situation, he was killed.

According to the Huffington Post, Ape was only 2 years old when he was killed in the line of duty. The Czech German Shepherd had just graduated from a tactical training course two weeks prior and was on his second mission with the FBI.

In response to the danger posed by Myers, FBI agents sent Ape into the building with a remote camera before officers attempted to confront Myers face-to-face. Shortly after Ape entered the building, Myers began firing at the dog and officers.

In the firefight, Myers shot at the officers and hit Ape. Police then returned fire and killed Myers on the scene. Following Myers’ death, officers made every attempt to save Ape’s life, administering CPR on the scene and rushing him to a local veterinarian. Ultimately, however, Ape died soon after

“Ape was doing what he was trained to do and made the ultimate sacrifice for his team,” FBI Agent Ann Todd told the New York Times. “His actions were heroic and prevented his teammates from being seriously wounded or killed.”

In accordance with the protocol, Ape will be taken to the FBI headquarters in Quantico, Va., and buried at the site. Ape’s name will also be memorialized in a wall dedicated to honoring FBI dogs killed while on duty.

The New York Times notes that while the FBI did not comment on the specific reasons why Ape was sent into the building, they maintain that dogs are frequently used by police forces to survey extremely dangerous situations.