California state prisoners are killed at a rate that is double the national average, and sex offenders account for a disproportionate number of victims, according to an Associated Press analysis of corrections records.

Male sex offenders made up about 15 percent of the prison population but accounted for nearly 30 percent of homicide victims, the AP found in cataloging all 78 killings that corrections officials reported since 2007, when they started releasing slain inmates' identities and crimes.

The deaths — 23 out of 78 — come despite the state's creation more than a decade ago of special housing units designed to protect the most vulnerable inmates, including sex offenders, often marked men behind bars because of the nature of their crimes.

Some have been killed among the general prison population. Others are killed within the special units. Officials acknowledge that the units, which also house inmates trying to quit gangs, have spawned their own gangs.

Corrections officials blamed a rise in the prison homicide rate on an overhaul meant to reduce crowding. The state in 2011 began keeping lower-level offenders in county jails, leaving prisons with a higher percentage of sex offenders and violent gang members.

Violence and homicides won't decline unless the state goes well below the prison population level set by the courts, which is 137.5 percent of the system's designed capacity, said James Austin, president of the JFA Institute, a Washington-based consulting firm that works on prison issues.

"Until the state gets its prison population below 100 percent of capacity, you're going to have this," he said.

Overall, 162 California prisoners were killed from 2001 to 2012, or 8 per 100,000 prisoners — double the national average over the same time period and far higher than those of other large states, including Texas, New York and Illinois, according to federal statistics.

From 2012 to 2013, the most recent years for which California data were available, the rate rose to 15 per 100,000, according to a federal report, though corrections officials said the number of deaths dropped last year.

Department spokeswoman Terry Thornton would not comment on the possible reasons for California's long-term trend of inmate homicides.

Last fall, the corrections department's inspector general reported that so many homicides occurred in the "increasingly violent" special housing units reserved for vulnerable inmates that the department could no longer assume that inmates there could peacefully co-exist.

The report looked at 11 homicide cases that were closed in the first half of 2014 and found that 10 victims were sensitive-needs inmates. Using corrections records, the AP found that eight of them were sex offenders.

One was Alan Ager. Shortly after 2 a.m. on April 6, 2010, a guard at Salinas Valley State Prison noticed Ager's cellmate trying to stuff something under a mattress. It was Ager, blood trickling from his mouth and a cloth noose tied around his neck.

The 63-year-old convicted child molester died 10 days later without regaining consciousness. His cellmate, Clyde Leroy Beaver, was a convicted murderer. Beaver pleaded guilty to murder in Ager's death and got another life sentence.

Ager had been kept in special housing when he first entered the prison system at San Quentin. But he was housed with general-population inmates soon after his transfer to Salinas Valley because officials there decided he didn't need extra protection.

A federal judge ruled in March that Ager's family failed to show that prison officials acted with deliberate indifference.

"The very day they let him into the yard, he was filing complaints, 'Get me the hell out of here,"' said Ager's son, Daniel.

Experts said California could better protect sex offender inmates by separating them into their own facilities.

The Associated Press