Fearing for their lives, California deputies opened fire on a man who was recording them with a cell phone from the garage of his home Friday, claiming they thought it was a gun.

Sacramento County sheriff’s deputies then searched the man’s home, finding no guns, before they apologized and went on their way.

Fortunately, Danny Sanchez survived the shooting, ending up with only bullet fragments in his legs, which he was having removed through surgery on Friday.

And although deputies apologized to Sanchez, they are pretty much unapologetic for their actions because, you know, officer safety.

According to KCRA:

“I think it’s reasonable to think that the officers perceived an immediate threat either to themselves or continued threat to that individual,” said Sgt. Jason Ramos, of the Sacramento County Sheriff’s department.

According to CBS Sacramento:

“He found himself in the midst of things and some of his actions were perceived to be threatening to law-enforcement officers,” Ramos said.

The incident took place in Rancho Cordova as Sacramento County deputies were arresting Sanchez’s next-door neighbor after a two-hour standoff.

His neighbor, Ben Ledford, 62, is accused of shooting a machine gun at the house across the street, killing that family’s dog.

As they were arresting Ledford, Sanchez, who was standing inside his garage with the door open, extended his arm out with the cell phone to record.

That was when two deputies opened fire, leaving bullet homes in the garage and the family car as well as bullet fragments in his leg.

From KCRA:

Sanchez’s father John “Sonny” Sanchez said the object was a cellphone and his son was trying to videotape the arrest of Ledford, when he was shot in the leg.

“He was yelling, ‘Dad I’m shot, I’m shot,’ so I grabbed him inside and closed the garage door. I put a tourniquet around his leg and a clean towel,” John Sanchez said.

Sanchez pointed out four bullet holes in his garage and several more in his car.

“You can see how many shots they did: one, two three, four — shooting at my son with a cell phone. C’mon that’s ridiculous,” Sanchez said.

Deputies said there was a lot of commotion as Ledford was being taken into custody.

Deputies said SWAT officers positioned down the street didn’t know if there was a second gunman in the area because of all the earlier gunfire and didn’t recognize the object in Danny Sanchez’s hand was a cellphone.

But let’s not forget the standoff last two hours. And let’s not forget that the only person accused of a crime in that situation was Ledford, whom they were already taking into custody when they shot Sanchez.

And then for them to search Sanchez’s home after realizing all he was doing was trying to record?

The two deputies who shot him have not been identified, but have been placed on paid administrative leave as the sheriff’s office conducts its “investigation.”

It is not clear at this time if Sanchez recorded any video of the incident or if it was seized as “evidence” by deputies.