The man shot and killed by a Border Patrol agent Wednesday had taken another agent’s gun out of its holster, a Border Patrol official said.

Two agents responded to a sensor that was activated in the Baboquivari Mountains southwest of Tucson around 11:30 a.m. Wednesday, Rodolfo Karisch, chief patrol agent of the Border Patrol’s Tucson Sector, said at a news conference Thursday.

The agents tracked a group of suspected illegal border crossers to an area about 21 miles north of the U.S.-Mexico border. While trying to arrest the border crossers, one of them attacked an agent, Karisch said.

“There was a struggle. The assailant wound up on top of the agent and was able to pull his weapon from his holster, at which time the other agent came up and shot the individual,” Karisch said.

The man died later from his wounds.

Karisch called the shooting a “heroic act” and said the agent who fired “saved his partner’s life.”

An agent suffered minor injuries and was treated at a Tucson hospital.

The Border Patrol did not release the nationality of the man who was killed. Three Guatemalan men who were part of the group of suspected illegal border crossers were taken into custody on immigration violations.

The Tohono O’odham Police Department is the lead agency in the investigation of the shooting. The FBI and U.S. Customs and Border Protection’s Office of Professional Responsibility have supporting roles in the investigation.

CBP reported 66 use-of-force instances of Border Patrol agents in the Tucson Sector from the start of the fiscal year on Oct. 1, 2016 to Aug. 31. Three of those instances involved firearms. Agents also used firearms Nov. 28 while assisting state troopers during a shootout at a rest area on Interstate 10 near Tonopah west of Phoenix.

Contact reporter Curt Prendergast at 573-4224 or cprendergast@tucson.com or on Twitter @CurtTucsonStar