Twenty-four hours a day for 10 weeks, inmates in maroon uniforms with "D.O.C." stamped on the backs held a death vigil over Frank Rodriguez. His colon cancer was terminal, but he refused to die — not behind the barbed wire and bars of Graterford Prison.

Like most states, Pennsylvania has a compassionate-release law, a way out for dying inmates. Rodriguez, who was so weak he needed help eating, bathing, and turning on his side, qualified. But successful petitions are exceedingly rare and excruciatingly slow.

Rodriguez had not committed a violent crime. He was locked up on a parole violation — smoking marijuana — for the underlying offense of stealing a $1 lemonade from a 7-Eleven store in 2013.

Yet to be allowed to die outside prison, he'd need a raft of forms and records, a judge's approval and — though he was too weak to walk — an electronic monitor on his ankle.

His sister Miriam said he finally came home Aug. 25. He died Aug. 27.

"After this two-month struggle, when we got him into hospice, he was a 57-year-old skeleton," she said. "All we had was a day and a half of him before he passed. We could have had months of him if not for all this paperwork."

She'll never forget the dark comedy of the hospice staff struggling to find a pair of scissors that could slice off the monitor that hung loose from his bony ankle. Nothing worked.

"Our family was devastated. Let him die with dignity," she said. "They let the morgue pick him up with that still on him."

Even as Pennsylvania has incrementally reduced its prison population, the number of elderly inmates has grown at a startling rate. In 2001, there were 1,892 geriatric inmates, age 55 or older. Today, there are 6,458 of them.

They're typically people serving very long sentences for a single, very serious crime, noted Rutgers University criminologist Todd Clear. ("This is a particularly American problem," he noted. "The U.S. has a kind of world monopoly on extremely long sentences.")

"They are among the lowest-risk people in the prison," he said.

They're also wildly expensive to house, even compared to Pennsylvania's average per-inmate cost of $42,727 a year. Researchers estimate caring for an elderly inmate costs three to nine times more than housing a younger prisoner.

In 2008, the commonwealth reformed its compassionate release law with an eye to shifting some of those people out of prison, partly to contain costs.

"What happened was, the law is now worse, and only people that are going to be dead within weeks get out," said Angus Love, of the Pennsylvania Institutional Law Project. "We had one person die as they were going to be wheeled out the door."

The law's language, he noted, is extremely restrictive: Applicants must be near death and unable to walk. Since January 2015, 483 inmates have died in state prison; 343 of them 55 or older. Few bother seeking compassionate release. In the last two years, only 24 people have applied, and about six were approved.

Brie Williams, an expert in criminal justice and geriatrics at the University of California, San Francisco, has argued for an evidence-based approach, given the population's low risk of recidivism.

"As a society we have decided — in most states and in federal prisons — to create a policy for the seriously ill to be released prior to sentence completion if they have a reasonable release plan. But we do not use this mechanism to the full extent of its capacity," she said.

Part of the problem, she added, is that such policies require doctors to predict how long patients have to live. And doctors aren't good at such predictions. They're also not good at communicating those prognoses to dying patients so they can plan accordingly. She said one solution would be to automate compassionate-release requests when patients are given terminal diagnoses rather than placing the burden on family to advocate for them.

Rodriguez, for one, did not understand the seriousness of his condition until it was nearly too late, said Francisco Mojica, a lifer who cared for him in the prison hospice.

Unlike most elderly inmates, Rodriguez was familiar with short stints in prison. He had been a habitual and petty thief, and not a particularly gifted one. He once stole a purse from a bar, then was caught after he dropped his phone.

His sister believes he could not help himself. A janitor and a father, he was slow to anger, quick to joke, kind but troubled. "He never hurt anyone. He doesn't curse," she said. "He had an illness. He never damaged cars, but he broke into cars for change. He thought it was a thrill."

The case that really got him in trouble, in 2013, was that stolen lemonade. Because of habitual offender statues, it could have carried a sentence of up to seven years.

Instead, Rodriguez was sentenced to just six to 12 months in prison — but, soon, he violated parole, and prison time was added. First, he was caught stealing change out of a coworker's car and got a year's probation. Then he failed a drug test, and landed in state prison again.

"When you have a history of committing offenses, the punishments tend to get harsher," said Syzane Arifaj, the Northampton County public defender who won his release. "Nothing warranted him staying incarcerated while dying on a retail theft charge."

After 17 rounds of chemotherapy in prison, Rodriguez was deemed terminal.

Mojica urged him to file for compassionate release. Finally, he placed a call to Rodriguez's sister.

"I told her, 'Look, Franky is going to die, and if you don't get him out, he's going to die in here.' "

Arifaj had never handled such a petition, nor had any other lawyer she asked. Obtaining the necessary documents was slow going. "There doesn't seem to be any urgency on the side of the institution," she said.

(Advocates with Drexel's Community Lawyering Clinic reported seeking expedited medical records for another inmate, dying of pancreatic cancer. They did not receive them for two weeks — five days after the man's death.)

Arifaj finally obtained a hearing date for Sept. 1.

Miriam insisted that was too late. "Frank told me, 'I don't think I can hang in another week,' " she said. In desperation, she went to the courthouse in person, wandering the halls, hoping to speak with a judge.

Her brother finally came home in an ambulance, with his skin worn through at his tailbone. He spent his last day alive surrounded by his family.

Still, Arifaj said, "at least he did get out. There are people who never get that day."