EL PASO, Texas (Border Report) — An Arizona Border Patrol agent shot and killed an undocumented immigrant who stabbed him several times.

The agent was on foot patrol about 7 p.m. Tuesday near Nogales when he encountered a group of individuals.

One of the individuals allegedly attacked the agent with a knife and stabbed him several times, U.S. Customs and Border Protection said in a news release. The agent shot and killed the assailant.

A CBP helicopter flew the agent to the Nogales airport, where medics were waiting for him. The agent was ultimately flown to a hospital in Tucson, Arizona, where he was treated for his wounds and later released.

In a statement, CBP said the FBI, CBP Office of Professional Responsibility, DHS Office of Inspector General, and Santa Cruz Sheriff’s Office responded to the scene, with the FBI leading the investigation.