Denver (ap) — A clerical error allowed the man suspected of killing Colorado’s prisons chief to be released from custody about four years early, officials said yesterday.

In 2008, Evan Spencer Ebel pleaded guilty in rural Fremont County to assaulting a prison guard. In a plea deal, Ebel was to be sentenced to up to four additional years in prison, to be served after he completed the eight-year sentence that put him behind bars in 2005, according to a statement from the 11th Judicial District.

However, the judge did not say the sentence was meant to be “consecutive,” or in addition to, Ebel’s current one. So the court clerk recorded it as one to be served “concurrently,” or at the same time. That’s the information that went to the state prisons, the statement said.

So on Jan. 28, prisons officials saw that Ebel had finished his court-ordered sentence and released him.

Two months later he was dead after a shootout with authorities in Texas. The gun he used was the same used to shoot and kill prisons chief Tom Clements two days earlier. Police believe Ebel also was involved in the death of a Domino’s delivery man, Nathan Leon, in Denver.

“The court regrets this oversight and extends condolences to the families of Mr. Nathan Leon and Mr. Tom Clements,” said a statement signed by Charles Barton, chief judge of the 11th Judicial District, and court administrator Walter Blair.

Corrections officials said they had not calculated precisely the number of days Ebel would have remained behind bars had the sentence been consecutive. They said they had no way of knowing the plea deal was intended to keep Ebel behind bars for years longer.

The attack that led to the plea deal took place in 2006.

According to prison and court records, Ebel slipped his handcuffs while being transferred from a cell and punched a prison guard in the nose.

also threatening to kill the guard’s family. Ebel spent much of his time behind bars in solitary confinement and had a long record of disciplinary violations.