Six Santa Clara County peace officers lawfully shot an unarmed, suspected drug dealer during an undercover operation outside of Hobee’s last year, according to the Santa Clara County District Attorney’s Office.

Officers shot and killed Juan Ruelas, 34 of Sunnyvale, outside the W. Ahwanee Avenue restaurant on Sept. 4, 2013. An undercover officer was set to buy a pound of methamphetamine for $10,000 from, who had sold methamphetamine five times before to an undercover officer.

Ruelas allegedly threatened the officer, saying he had a gun, before making a fatal movement that prompted the shooting.

The supervising deputy district attorney who authored the D.A.’s report on the shooting concluded that the fact that Ruelas was unarmed at the time of the shooting “does not negate a legal justification for the shooting as long as officers honestly believed he posed an imminent threat of death or great bodily injury to them or others.”

The day of the shooting, Ruelas was sitting in his truck when he handed over the drugs, the office reported. After the transaction, the undercover officer, Detective Travis Niesen, gave the coded arrest signal and stalled, waiting for the backup officers to arrest him.

According to the report, Ruelas told the officer, “I got a gun, don’t do anything stupid.”

In return, hoping the arrest team would hear, the undercover detective said, “Dude, why did you bring a gun?”

It was at that point that Ruelas reached with his left hand toward his waist. Out of fear that he was about to be shot, the officer pulled his gun and fired, the District Attorney’s Office reported.

Santa Clara Police Sgt. Greg Hill, Santa Clara Police Detectives Cory Morgan, Justin Mead and Jake Thompson, and Santa Clara County Deputy Sheriff Tyler Fernandes responded and opened fire, hitting Ruelas 29 times.

An autopsy showed Ruelas was intoxicated on amphetamine and methamphetamine at the time.

Ruelas’ family filed a federal civil rights lawsuit in May, saying police shot an unarmed man without justification. The lawsuit is still pending.

The District Attorney’s Office investigates all fatal law enforcement encounters to determine if the lethal force was legal.