WASHINGTON (Reuters) - A gang-related melee at a South Carolina prison that ended with seven dead and 17 injured, the deadliest U.S. prison riot in a quarter century, exposed the vulnerability of an understaffed system.

FILE PHOTO: A guard tower is seen at the Lee Correctional Institution in Bishopville, Lee County, South Carolina, U.S., April 16, 2018. REUTERS/Randall Hill/File Photo

Forty-four guards were on duty overseeing 1,583 inmates at Lee Correctional Institution in Bishopville, South Carolina, when the violence broke out, and it took eight hours to put an end to the riot early on Monday.

Across the country, cuts to state budgets have left state prison systems understaffed, a reality that prison officials and law enforcement experts say increases the risk of being unable to contain any outbreaks of violence quickly.

“We’re grossly understaffed at many facilities across the United States,” said Brian Dawe, executive director of the American Correctional Officer Intelligence Network, a clearinghouse for best practices and information for corrections officers and others.

The South Carolina riot was sparked by a fight among prison gangs over turf and contraband around the time of a shift change in three cell blocks. That meant more staffers than usual were present, but the melee still went unchecked for hours, Bryan Stirling, South Carolina’s prison director, told a news conference.

About a quarter of South Carolina’s state prison guard jobs are unfilled, Stirling told The State newspaper in January. South Carolina is far from alone in having double-digit vacancy rates.

There are no national figures on prison staffing, but state records show that 16 percent of guard jobs are unfilled in Delaware and 31 percent in Oklahoma, as well as 15 percent of all corrections jobs, including guards, in Arkansas.

Similarly, 16 percent of guard positions in North Carolina prisons and 14 percent in Texas were unfilled late last year, according to local media. Missouri had a shortage of more than 400 guards and officers were being bused from one prison to another on overtime to cover shifts.

The federal system had a ratio of 10.3 inmates per correctional officer in 2005 and a ratio of 4.9 inmates per prison staff, according to the Bureau of Justice Statistics. In some states facing staff shortages, there might be one officer for every 40 or 50 inmates, union officials said.

Slideshow ( 2 images )

The ratio at the Lee Correctional Institution Sunday evening was 35.9 inmates per guard.

Dawe put the ideal ratio at about five to one, but Michele Deitch, a lecturer on corrections at the University of Texas, said it depended on layout of the prison and the type of facility, such as whether it was minimum or maximum security.

“It’s not like you can take one number and apply it to every facility,” Deitch said. “It’s not really a great indicator.”

Compounding the chaos, when the fighting erupted in South Carolina on Sunday, all the guards pulled out to await police backup. It took four hours for officers to move into the first dorm, and their response was slowed by having to deal with wounded inmates, Stirling said.

Shaundra Scott, executive director of the American Civil Liberties Union in South Carolina, said the mayhem underscored that state prisons lack personnel to keep inmates safe, as well as protocols to quell unrest.

“They don’t have the staff to keep things running in the prison,” she said. Scott added that mixing juvenile with adult inmates, the use of solitary confinement and a lack of mental health treatment also fed violence.

South Carolina Department of Corrections spokesman Jeffrey Taillon declined to comment on Wednesday. He referred a reporter to Stirling’s Monday statement that the state was beginning to retain staff through extra pay, bonuses and overtime after years of losing about 150 officers annually.

The number of Americans in state prisons fell to 1.38 million in 2016, down about 4 percent from a decade earlier, according to U.S. Department of Justice data. But experts say the drop was not enough to close the guard shortage substantially.

Budgets have been cut for several years, with a survey of 45 states by the Vera Institute of Justice in New York showing a 0.5 percent decline in prison expenditures from 2010 through 2015. South Carolina’s spending dropped 2.4 percent over that period, with the sharpest declines in Nevada, down 14.7 percent, and Michigan, down 12.4 percent.

Oklahoma Corrections Director Joe Allbaugh, citing the South Carolina violence, said he recognized the risks potentially facing prisons in his cash-strapped state, which announced a hiring freeze on corrections officers in February.

“This could have easily been us,” Allbaugh, who has been critical of a funding shortage in a state with one of the highest rates of incarceration, said on Twitter.

Plagued by high turnover, some prisons are turning to overtime to make up for staffing gaps as they struggle to fill low-paying jobs seen as dangerous and undesirable in a growing U.S. economy with a tight labor market.

Jackie Switzer, a former prison guard and executive director of the Oklahoma Corrections Professionals lobbying group, said officers often were asked to work overtime or double shifts.

“They are not as responsive as they would be if they were fresh. That in turn creates a dangerous situation,” he said.