An Arizona police K-9 was fatally shot while trying to catch a fleeing suspect who was later found dead, authorities said.

Investigators were trying to nab Joe Ruelas, a 38-year-old man wanted for aggravated assault, around 5:20 p.m. on Friday when he apparently tried making a run for it.

LAS VEGAS POLICE K-9 STABBED REPEATEDLY BY SUSPECT 'DOING EXTREMELY WELL' IN RECOVERY

A K-9 with the El Mirage Police Department, named Koki, was unleashed and tried to capture Ruelas on foot, KSAZ-TV reported. But during the pursuit, Ruelas shot Koki, officials said.

Koki, a K-9 officer with the El Mirage Police Department, was shot and killed while trying to catch a fleeing suspect on Friday night, the police chief said. 

Koki, a K-9 officer with the El Mirage Police Department, was shot and killed while trying to catch a fleeing suspect on Friday night, the police chief said. 

Two police officers fired back at Ruelas, who ran out of sight. He was later found dead from a self-inflicted gunshot wound, according to police.

TRUMP IDENTIFIES 'CONAN,' MILITARY DOG IN BAGHDADI RAID, SAYS SHE WILL VISIT WHITE HOUSE

Paul Marzocca, police chief in El Mirage, said the beloved K-9 was "killed in the line of duty tonight protecting other officers from harm."

"The loss of Koki is no different than the loss of a Police Officer," Marzocca said in the statement. "Today the El Mirage Police Department mourns Koki, we lost a brother last night."

Marzocca wrote on Facebook Friday night "the community is safe and the suspect is no longer a threat," and thanked the various officers and fellow agencies "that gave their many resources to help us tonight."

CLICK HERE TO GET THE FOX NEWS APP

Koki, according to the Officer Down Memorial Page, served with the El Mirage Police Department for four years.