A man will spend 25 years in prison after he and an accomplice attempted to rob and kill an undercover Alcohol, Tobacco, Firearms and Explosives (ATF) agent.

Maurice McKinley, 23, of Athens, pleaded guilty to attempting to kill a federal officer and discharging a firearm to commit a crime, according to a news release from the U.S. Attorney’s Office of the Middle District of Georgia.

“McKinley showed a complete and utter disregard for human life when he attempted to murder a federal agent,” Assistant Special Agent John Schmidt said in the release.

According to the release, the undercover agent was meeting with McKinley to buy an AK-47 or SKS-style assault rifle and marijuana for $800. The agent was working as part of an operation to target illegal gun and narcotics sales in Athens.

The agent was initially told to meet McKinley at a convenience store parking lot, but McKinley admitted he convinced him to meet down a nearby dirt road.

After the two arrived, McKinley’s accomplice, Javonta Terrell Darden, arrived with what was believed to be a duffel bag with the firearms and marijuana. Instead, Darden dropped the bag, which had only sticks and pieces of wood in it. He then pulled a gun on the agent, the release said.

Darden ordered him to the ground as McKinley dug in the grounded agent’s front pocket and took $400 cash, according to the release. McKinley then searched the agent’s car for other valuables.

The agent, who was still held at gunpoint, was able to draw his gun and fired several shots at Darden, who died during a struggle with the agent.

McKinley managed to attack the agent after the shots rang out, striking him in the head with the agent’s gun. As he tried to escape, McKinley fired a shot into the agent’s back that went through his right shoulder and lodged into his jawline, breaking it.

“It is only through bravery, perseverance and extremely good luck that the agent Mr. McKinley tried to kill is alive and has recovered after being shot in the back while unarmed and posing no threat whatsoever,” U.S. Attorney G.F. Peterman said in the release.

Peterman said the agent’s actions that night were a reminder of law enforcement officials’ bravery in the line of duty.