Two police officers were injured Saturday when a trespassing suspect they were approaching at an Arizona Walmart pulled out a gun and opened fire, police said.

Despite being shot multiple times, the officers were able to return fire and killed the suspect, who police said was a “transient” who had previously been charged with trespassing at the Walmart in Chandler.

“They acted heroically this morning,” Chandler Police Chief Sean Duggan said of the two officers, who were not immediately identified.

One of the officers was shot in the face and underwent surgery at a local hospital, Fox 10 News reported.

Duggan told a Saturday afternoon press conference that the officers had been dispatched to the Walmart on a routine call regarding a trespassing. A store employee had called police about the suspect, identified as Mitchell Oakley, 24, around 6:20 a.m. Saturday.

Cops said Oakley shot the officers as they got close to him near the store’s entrance.

Duggan said both officers were wearing bullet-proof vests.

“A seemingly routine call turned into a deadly encounter in a matter of seconds,” the chief said.

A shopper helped responding officers administer first aid to the wounded officers until they could be transported to the hospital, Duggan said.

Both officers were listed in stable condition after they arrived at the hospital, according to Fox 10.

Click here for more from Fox 10 Phoenix.