TAMPA, Fla. (WFLA) — A U.S. Customs and Border Protection officer died in an accidental shooting following Wednesday a gun mix-up at a west Miami-Dade gun range, reports said.

The shooting happened just before 11 a.m. at the Trail Glades Range in western Miami-Dade County, Miami-Dade police spokesman Angel Rodriguez said during a news conference Wednesday afternoon.

The agent, later identified by local news outlets as Officer Jorge Arias, was airlifted to a Miami trauma center, where he died from his injuries.

According to WPLG, Arias was assigned to the Miami International Airport as part of his regular duties but was serving as a firearms instructor at the time of the shooting.

The incident began when during a role-playing exercise when each participant swapped their real weapons for training guns.

Unidentified sources told WPLG an officer conducting the exercise with Arias left the room momentarily with his real gun but forgot to swap it back for the training weapon when he returned, leading to the accidental shooting.

Miami-Dade homicide detectives will investigate the shooting.