SANTA FE, N.M. (KRQE) – An inmate at the New Mexico State Penitentiary told authorities he planned to kill a prison guard who disrespected him, now he’s charged with attempted murder along with two others.

Video released Wednesday showed how Lorenzo Martinez, 25, carried out the sneak attack inside the state pen.

It was just after 10 a.m. on August 3 when two guards began to release inmates for recreational “tier” time.

These inmates were being housed on level six — the level that houses the worst-of-the-worst violent offenders.

According to an arrest warrant affidavit, it’s the same pod that housed inmates: Lorenzo Martinez, Joe Martinez, 32, and Carlos Mendez, 26.

Lorenzo and Joe both have histories of attacking guards in jail, while Mendez is severing a 12-year sentence for attempted murder and kidnapping.

Prison surveillance video shows Mendez talking with one of the guards around 10:20 a.m. Lorenzo stepped out of one of the cell doors. He put his arms up so the guard could pat him down, but as he stepped forward he immediately put both hands inside his shirt. That’s when Joe made his move.

Investigators said Mendez kept the guard talking as a “distraction.” Within seconds, it appeared that Joe removed something from his waistband and started to attack the guard, from behind, with a homemade shank. Lorenzo also joined in.

According to the affidavit, the second corrections officer in the pod “discharged pepper spray toward Joe Martinez and Lorenzo Martinez.”

That sent Lorenzo chasing after the second guard.

Investigators said a third corrections officer, who was watching from the observation deck, fired three rounds from a “less-lethal” shotgun. It sent the inmates flying to the ground and ultimately ended the attack.

All three inmates are charged with attempted murder.

Joe and Lorenzo told investigators the weapons were made of pieces from a steel fence and a metal door. The two were moved to the segregation unit.

The two guards were treated and released from the hospital the day of the attack. They are expected back to work Thursday.

The Corrections Department is working in conjunction with New Mexico State Police to conduct an investigation into the attack.