

PITTSBURG, Calif. -- The man who allegedly shot a Pittsburg police officer inside the department's booking facility Thursday was able to smuggle a gun into the building despite being searched twice.
The man, 31-year-old Michael Sanchez Gardner Martin, was searched twice by the same officer before he later allegedly beat and shot Officer Jimmy Sanchez as he was being prepared for a transfer to Contra Costa County Jail, Pittsburg Police Chief Phil Galer said in a news release Tuesday.
RELATED: Officer allegedly shot by suspect with concealed weapon inside Pittsburg PD holding cell: sources
Galer said Martin was brought into the department's facility after being arrested for allegedly driving a stolen vehicle and having outstanding felony warrants.
He was searched once during his arrest and once again after being taken to the department's booking facility, but the young officer who conducted both searches failed to discover a gun hidden inside Martin's clothes, according to Galer.
"That was a serious failure. We acknowledge it, and it will be thoroughly examined through an administrative investigation," Galer said. "We will determine how it happened and take immediate corrective action to prevent it from happening again."
After being placed in a holding cell, Martin allegedly hid the gun inside a toilet, retrieved it a few hours later and then hid it under a jail-issued blanket he had draped over his shoulders, Galer said.
Sanchez, who was not the arresting officer or the one who conducted the searches, gave Martin some water after he said he wasn't feeling well.
MORE: Richmond officer shot during welfare check; woman arrested after hourslong standoff: police
"Officer Sanchez brought him water and approached the cell to check on his welfare," Galer said. "Without warning, he punched Officer Sanchez in the face, threw the blanket over his head and repeatedly struck him in the head with the firearm."
During the struggle, Martin allegedly fired one round that first went through his own thigh before hitting Sanchez in the abdomen below his body armor, Galer said.
Additional officers soon responded to the attack and were able to disarm Martin before he could fire off any more rounds.
"Officer Sanchez had been ambushed, beaten and shot. He still did not stop fighting," Galer said.
INTERACTIVE: Take a look at the ABC7 Neighborhood Safety Tracker
Martin was treated at a hospital and was booked into jail on suspicion of multiple felonies, including attempted murder of a police officer and several gun-related offenses.
He is being held without bail and is scheduled to appear in Contra Costa County Superior Court in Martinez on Sept. 16.
Sanchez had surgery "and is recovering with family and the department by his side," Galer said.