GILROY (CBS SF) — The Santa Clara District Attorney’s Office, concluding a nearly 8-month-long investigation into the Gilroy Garlic Festival mass shooting, ruled Tuesday that police officers were justified and courageous in engaging Santino Legan into a fatal gun battle.

Around 6:30 p.m. on July 28, Legan entered the festival through a locked access gate wearing a bullet-proof vest and armed with a loaded AK-47 assault rifle with dozens of rounds of ammunition.

READ MORE: News Crew Security Guard Shot In Oakland Dies From Injuries

After making his way to an inflatable slide play structure centrally located among several vendor booths and picnic tables, he opened fire. In all, Legan fired at least 36 rounds of ammunition in just a few minutes, hitting 20 men, women and children. The salvo proved to be fatal to 6-year-old Stephen Romero, 13-year-old Keyla Salazar 25-year-old Trevor Irby, who each died of a single gunshot wound to the torso.

Deputy Santa Clara County District Attorney Rob Baker, who authored the report​, concluded if it wasn’t for the heroic actions of Gilroy Police Detective Eric Cryar and officers Robert Basuino and Hugh Del Moral, the toll could have been much higher.

“Placing themselves, literally, in the line of fire to stop a mass murderer undoubtedly saved lives and prevented further bloodshed,” Baker wrote. “In light of the grave circumstances of this case, their actions were unquestionably lawful and justified.”

READ MORE: UPDATE: 2 Men Shot Outside South Bay High School Football Playoff Game

Once Legan began shooting, Cryar, Basuino and Del Moral rushed to the scene. Initially, the arriving officers could not tell if Legan was the shooter or an officer responding to the scene because of his body armor.

The Legan turned his gun on the officers and opened fire. The three officers returned fire, striking Legan multiple times in his chest, back, hands and legs.

The wounded Legan then put the muzzle of his assault rifle to the roof of his mouth and pulled the trigger, taking his own life.

“If we didn’t take the action that we took there could be a lot of dead people,” Cryer told the DA Office’s investigators.

MORE NEWS: COVID: Expert Says New Omicron Coronavirus Variant Likely Already in U.S.

The DA investigation center only on whether or not the officers use of deadly force. Both the FBI and the Gilroy police have ongoing investigations into other aspects in the case including what motivated Legan to come to the festival heavily armed and open fire.