Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Gang-related fights over territory and cellphones and other contraband provoked several hours of rioting and upheaval at a maximum-security prison in South Carolina, where seven prisoners were killed amid the chaos, state corrections officials said Monday.

All the dead at the Lee Correctional Institution in Bishopville were killed by their fellow prisoners, and were mostly stabbed or slashed with homemade knives, authorities said. An additional 17 inmates were injured and treated at hospitals.

Corrections officials added that no law enforcement or prison officers were harmed in the series of fights at the prison, which has a history of deadly violence and was once referred to as the "state's most dangerous prison."

"These are dangerous people. They are in prison because they have been judged to be so dangerous to be required to be kept in prison," South Carolina Gov. Henry McMaster said at a news conference Monday afternoon. "So we can't expect them to give up their dangerous ways."

The fighting began at 7:15 p.m. ET Sunday, and it wasn't until nearly eight hours later, just before 3 a.m. Monday that the facility was fully secured, the South Carolina Department of Corrections tweeted.

Bryan Stirling, director of the Department of Corrections, told reporters that after the first fight broke out in one dorm, a second and third started about an hour and a half later in two other dorms. Emergency officials were left scrambling to get proper backup from the South Carolina Law Enforcement Division, a statewide law enforcement agency. A large team couldn't even properly respond to the first fight until 11:30 p.m.

Forty-four prison staffers were on duty at a facility that houses about 1,500 inmates, Stirling said.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

While it might normally take one to two hours to safely clear a dorm, which houses about 250 inmates, this was an unusual case because of the series of fights in three separate dorms, corrections officials said.

"We will gather a force that is safe, and we will go in and take that dorm back with force," Stirling said. "We are not going to put our officers and other staff in harm's way."

Inmates did not resist when the various dorms were taken back and brought under control, according to authorities.

Stirling couldn't confirm an Associated Press report from an inmate who said he witnessed the violence and saw bodies "literally stacked on top of each other." Stirling said bodies were left along fences, but were placed there by other inmates, not officers.

Several emergency crews across the region were called to the "mass casualty" situation, Lee County Fire and Rescue tweeted earlier Monday.

Lee County Fire/Rescue assisted With a Mass Causality Incident at Lee Correctional. Mutual Aid was received from FlorenceCounty EMS, Kershaw County EMS, Darlington County EMS, Lexington County EMS and Hartsville Rescue. Assistance was also received from Med One a private service. pic.twitter.com/P22A1ruzQY — Lee County Fire (@LeeCountyFire) April 16, 2018

The inmates who died were later identified as Raymond Scott, 28; Michael Milledge, 44; Damonte Rivera, 24; Eddie Gaskins, 32; Joshua Jenkins, 33; Corey Scott, 38; and Cornelius McClary, 33.

Lee Correctional, about 40 miles east of Columbia, houses some of South Carolina's most violent and longest-serving offenders. Two officers were stabbed in a 2015 fight. One inmate killed another in February.

A guard was also overpowered by several inmates last month at Lee Correctional, allowing them to take control of a building for more than an hour.

In another situation in 2012, an officer was attacked while escorting a nurse in one of the buildings, leading to a six-hour standoff. Inmates reportedly used smuggled cellphones to call 911 with their demands, but were stopped after more than 100 officers and agents used tear gas to get inside.

Smuggled cellphones continue to be a major problem throughout Southern prisons. In South Carolina, officers have found and taken one phone for every three inmates, the highest rate in the country, NBC News reported last year.

McMaster said he favors allowing the Federal Communications Commission to jam cellphone signals around prisons, which could deter smuggling and other criminal activity behind bars. The FCC has argued that it's up to prisons to police cellphone use and worries that interfering with cell signals could affect users outside the prisons.

South Carolina, meanwhile, is also grappling with a rise in inmate killings, state data shows.

The number of inmates killed in prison by other inmates rose to 12 in 2017 from three in 2015. Two of the deaths last year occurred at Lee Correctional, according to The State.

Stirling said chronic understaffing has meant that fewer employees are available to oversee inmates. Lee Correctional has a nearly 30 percent vacancy for front-line officers.

Adding to the difficulties that prisons face is that inmates are often unwilling to snitch about impending violence.

"It's hard to investigate these matters in prison because folks just aren't going to tell," Stirling told The State in January. "That's just the prison culture. You see something, you don't say anything."

State law enforcement officials said Monday that they would continue investigating the inmate deaths.