FRESNO, Calif. (AP) – Two unarmed officers were critically injured after being shot by a visitor in the lobby of a central California jail, authorities said Saturday.

Correctional Officers Juanita Davila and Toamalama Scanlan were shot in the head and neck areas during a struggle with a man who tried to cut to the front of the visitors' line and refused to take a seat when he began pacing near a secure area of the Fresno County jail, sheriff's spokesman Tony Botti said.

Scanlan, who has 10 years of experience, was hospitalized in critical condition. Davila, who has 18 years of experience, was listed in critical but stable condition, Botti said.

About 15 people, including small children, who were in the lobby ran to safety when the shots rang out around 8:30 a.m.

Christy Rodriguez told the Fresno Bee she and a woman with a walker hid in the bathroom after they heard the gunshots. Moments later, an officer yelled at them to get out of the building.

"This is crazy. This isn't supposed to happen," Rodriguez said.

Officers from the secured areas inside the jail ran to the lobby, where a lieutenant fired shots at the gunman, identified as 37-year-old Thong Vang.

Botti said Vang returned fire, but no one was hit. He said officers tried to subdue him with a stun gun, but he wouldn't give up and ran to the hallway of the jail records area. When confronted by sheriff's deputies and a Fresno police officer, Vang dropped his weapon and told authorities he wanted to be arrested, Botti said.

The injured officers were dragged out of the lobby and taken to the hospital to undergo surgery.

Vang was taken into custody and taken to the hospital for minor scrapes and cuts.

Botti said Vang is a convicted rapist who was released from prison in 2014 after serving 16 years for raping minors aged 14 and under. The parolee had no criminal violations since his release.