Updated

Investigators say a man who was shot and killed by a U.S. Border Patrol agent near San Diego threw several large rocks at the agent, including one the size of a basketball.

The San Diego County Sheriff's Department said Wednesday that the attacker began throwing fist-sized rocks at the agent from a hillside perch. The rocks got larger, and one of the bigger pieces hit the agent in the head.

The sheriff's department says the agent fired his gun twice Tuesday, fearing that he might be killed or incapacitated if he was hit again. The agent was treated for minor injuries at a hospital and released.

The episode has fueled debate about how the Border Patrol should respond to rock attacks.

The shooting was reported just before 7 a.m. PST about five miles east of  Paseo de la Fuente and Alta Road in rugged mountain terrain, according to San Diego County sheriff’s Lt. Jason Vickery.

Helicopter video showed the body of a man sprawled across rocks in a ravine on Otay Mountain, several hundred feet below a dirt road.

The shooting took place as two Border Patrol officers were chasing after a group of people suspected of illegally crossing into the U.S. from Mexico, officials from U.S. Customs and Border Protection told reporters.

The officer who shot the man has not been identified. He was treated for minor injuries.

The Associated Press contributed to this report