Discuss as:

Deputy shoots, kills 'out-of-control' inmate at San Diego hospital

View more videos at: http://nbcsandiego.com.

A San Diego County sheriff's deputy shot an unruly inmate who was receiving treatment at the UCSD Medical Center, police officials confirmed.

The shooting happened around 12:45 p.m. Saturday at the medical center on West Arbor Drive in the city's Hillcrest neighborhood.

Earlier in the day, deputies had transported a 45-year-old inmate from the downtown county jail to the UCSD Medical Center to receive treatment after a violent altercation with deputies.

Officials said deputies initially entered the inmate’s cell in the morning because he was non-responsive. When they went inside, the inmate allegedly attacked deputies with a dangerous weapon.

“He used that weapon, a hard object -- it was wrapped in some type of clothing material -- to strike both of the deputies in the head,” explained San Diego Police Capt. Terry McManus.

After the violent confrontation in jail, deputies subdued the inmate. He sustained injuries from the struggle and was transported to the UCSD Medical Center.

While receiving treatment in the CT scan room at the hospital, police said the inmate continued behaving violently toward deputies.

He was able to free himself from his wrist restraints and used one of the chain restraints to strike one of the deputies inside the CT scan room, officials said.

“He swung that chain material above his head in a circular motion with both hands and attacked the officers,” said McManus.

Watch US News crime videos on NBCNews.com

Deputies inside the room then used their batons and Tasers in an attempt to subdue the inmate, but to no avail. They described the inmate as “violent” and “out of control.”

Officials said the inmate continued to assault deputies, then stood up and aggressively charged one of the deputies with his arms raised above his head.

Upon being rushed, the deputy feared for his life and fired his service handgun at the inmate, officials said. It is unclear how many times the inmate was shot.

The inmate – whose name has not yet been released – died at the scene, officials confirmed.

A homicide team was called to investigate the shooting.

According to officials, the deputy who shot the suspect is a seven-year member of the sheriff's department. The deputy’s name was not immediately released.

More content from NBCNews.com:

Follow US News from NBCNews.com on Twitter and Facebook