Last Tuesday, a prisoner walked out of the Anchorage jail a free man. Unremarkable, except it was five months after his sentence ended.

By the Department of Corrections' own admission, the man — who the department would not name — spent nearly an extra six months incarcerated because of a clerical error in the computation of his complicated sentence.

His case is an extreme example of a widespread and insidious problem in Alaska's criminal justice system.

Over the past five years, DOC has kept — or would have kept if the errors hadn't been discovered by state investigators — more than 100 inmates in jail for days, weeks and even months after their sentences expired because of clerical errors, an analysis of data from the state ombudsman's office shows.

That number, attorneys and investigators agree, is probably a major undercount. It represents only inmates who've completed a lengthy formal process with the Alaska Office of the Ombudsman.

For every prisoner who complains, there are more who just sit a few extra days in jail, said Bethel attorney Jim Valcarce. He consistently fields two to three calls per month from people, almost all in rural Alaska jails, who say they've been detained for longer than their sentence.

"I've seen it a few days and I've seen it as long as a month," he said.

Those people are missing out on work, family life, subsistence activities, holidays, he says. They are missing out on their lives.

"I can't think of anything worse, more unfair, than someone who is sitting in jail for no reason. That's a miscarriage of justice."

Such errors break one of the foundational contracts of the justice system: That people should go free once they've served their time. At the same time, sentence miscalculations cost the already cash-strapped state hundreds of thousands of dollars.

The prisoner released Tuesday alone would have cost the state at least $23,000 in unnecessary incarceration.

Once they're out, inmates who have been incarcerated past their rightful release dates have no recourse. A decade-old Alaska Supreme Court decision stripped them of their ability to sue DOC for damages.

Thousands of days, hundreds of thousands of dollars

Many more prisoners are alerting the state about late releases today than they were five years ago, and more of the complaints are turning out to be justified.

The state ombudsman is charged with investigating citizen complaints against state agencies. Inmates have always been prolific in their grievances — the ombudsman receives more than 600 allegations against DOC every year. The biggest single category is medical care and treatment.

In 2012, the staff began to notice a marked increase in problems related to what is known in the system as "time accounting," said ombudsman Linda Lord-Jenkins.

The number of complaints has more than tripled: from 39 in 2012 to 140 in 2015.

More of them are turning out to be rooted in fact.

Ombudsman investigators substantiated 23 percent of prisoners' claims about sentencing errors in 2012. So far this year, they've found 35 percent to be justified.

The complaints come in a few different varieties: People who've actually been held too long, and people who ask to see their release date and realize there's an error before the day comes. (DOC says some people are also released early because of errors, but they don't tend to complain.)

Lord-Jenkins asked one of her investigators to try to calculate the number of days inmates who complained to her office, and had their cases substantiated erroneously spent in jail — or would have had the ombudsman not intervened.

The total: 2,355 days. That's nearly six and a half years. Multiply that by the cost to house an inmate overnight, and the total comes out to $373,677.85.

Those numbers again represent only the inmates who've gone through the entire grievance process via the ombudsman. It can take weeks or months. They also don't represent people who were released and then complained to the ombudsman's office, which can't do anything by that point.

In a Kafkaesque twist, the actual policy on time accounting was until recently classified by DOC, so lawyers and inmates themselves couldn't even look at it to see how their sentences were being figured. DOC recently released the time accounting manual for the first time, part of what new Commissioner Dean Williams says will be an effort to make the department more transparent to inmates and the public.

Often, the amounts of time are small — maybe two nights until the correct paperwork makes it to the right person.

To anyone who suggests a few extra nights in jail isn't a big deal, Anchorage attorney Philip Shanahan has this to say: "You spend a night in jail and see how you like that."

It happened to one of his clients just the other week. A release that was supposed to happen on Friday took until Tuesday.

"But without a real assertive client, you'd never hear about it," he said.

People staying in jail too long has always been kind of a head-scratcher for him.

"You'd think the DOC would have every interest in the world in getting people out on time."

No recourse, no accountability

The problem isn't new.

But before 2006, when inmates were accidentally kept too long in jail they regularly sued the state for extra time, said Valcarce, who represented more than a dozen plaintiffs in such suits. Usually, DOC would settle for $100-$200 a day.

"It gave the department some incentive to do their job," he said.

Then came Kinegak vs. Alaska Department of Corrections.

In 2002, plaintiff Lloyd Kinegak was held a week too long in the Yukon-Kuskokwim Correctional Center on a misdemeanor charge. He only got out after writing his probation officer a letter pointing out the problem. The extra days he was incarcerated caused him to miss out on important family activities with his young children and work. He sued on grounds the faulty record-keeping that led to his late release was negligent.

In 2006, the state Supreme Court ultimately ruled against him, saying his claim was one of false imprisonment, rather than negligence. The state is immune to claims of false imprisonment under the doctrine of "sovereign immunity."

The decision meant the end of the $100 per day settlements.

When DOC could no longer be sued by inmates for keeping them in custody too long, accountability ended, said Valcarce, who represented Kinegak in the lawsuit and said the result still torments him.

Since then, "the state absolutely has not done a better job," he said. "They've done a worse job."

A Byzantine system run on paper

So why are errors being made? One reason is the head-spinning complexity of sentencing.

"Some sentences are mandatory minimums, some are presumptive and part not presumptive," said Cynthia Strout, an attorney and the head of the Alaska Association of Criminal Defense Lawyers. "There's these calculations and formulas they have to follow, and it changes year by year."

Add multiple charges and time credits for time in halfway houses, plus esoteric parole and probation formulations and time off for good behavior and you've got "a big math problem," Shanahan said. "Like algebra. It becomes pretty complicated and silly, where it's really hard to explain to clients. Like, what the hell does this number even mean?"

On paper, sentencing calculations can look like "hieroglyphics," Strout said.

The understaffed time accounting system is also run largely on paper and fax machines. A computer system that can do simple calculations has been in place since 2013, according to DOC. But more complex calculations are done by hand.

At the busy Anchorage jail, where 36 or so convicted inmates are released every day, five people work on time accounting, according to DOC spokesman Corey Allen-Young. But at smaller institutions, there's usually a single person doing time accounting — and probably other duties, too.

Something's gotta give, said Lord-Jenkins.

When the longtime time accounting sergeant at the busy Anchorage Correctional Complex recently retired, "I just grasped my heart," Lord-Jenkins said.

Ombudsman staff noticed three "pervasive issues" that lead to problems: poor communications between jails, courts and halfway houses, lack of staff to do the work in a timely manner and the confusing aspects of probation and parole, especially when they run concurrently or someone gets credit for halfway house time.

"We don't want to beat up on the (time accountants), they've been real responsive to us," Lord-Jenkins said. "But it's an untenable situation right now."

"One error is one error too many"

Alaska is not the only state grappling with sentencing calculations.

A 2014 investigation by the Omaha, Nebraska World-Herald newspaper found prison officials had "wrongly released or were set to release" dozens of prisoners years before their sentences were supposed to end.

Earlier this year, top Washington prison officials resigned after the state admitted it had released 3,000 prisoners early over a period of 13 years.

Michigan recently spent $240,000 to institute a new computerized system sophisticated enough to calculate hundreds of different sentencing rules.

DOC says it doesn't know what it would cost to institute a new system. But it is going to start by tracking how often errors in time accounting happen.

"The fact that the issue is so complex is concerning," said spokesman Corey Allen-Young. "One error is one error too many."

And the prisoner who was let out of the Anchorage jail on Tuesday, five months late?