The criminal justice system is like a riddle: When is 30 years not 30 years? When the clock is set to Maryland time.

Jason Billingsley, the man charged in the killing of Baltimore tech entrepreneur Pava LaPere, was free despite a 2015 conviction for a brutal rape. Billingsley served about nine years of his three-decade-long sentence for that conviction.

Some critics have heaped blame on the Baltimore Police Department for not publicly disclosing Billingsley was the suspect in another brutal rape of a woman and attempted double killing the week before he was arrested and charged in the killing of LaPere.

Others, including Baltimore Mayor Brandon Scott, suggested the legal system failed, saying “when we look at the facts of the original case, you will agree that he should not have been out on the streets. … Rapists shouldn’t be let out early, period.” Baltimore State’s Attorney Ivan Bates blamed a “systematic failure.” But the mayor and chief prosecutor didn’t elaborate about the nature of the failure.

The Baltimore Banner thanks its sponsors. Become one.

The fact is that Billingsley’s release wasn’t the result of a failure — he didn’t fall through any cracks. His release wasn’t caused by a mistake or some kind of bug in Maryland’s criminal justice system. It was a product of the system and how it’s designed.

The 2013 rape in which Billingsley was convicted wasn’t his first violent act. In September 2009, when he was 18, Billingsley engaged in an attack and was convicted of first-degree assault that December. He was sentenced to five years, yet was released after spending only 2 1/2 months in jail — the time served between his arrest and sentencing. Why? Because the lion’s share of his sentence was “suspended,” meaning he didn’t really have to serve that time unless he later violated his parole or probation. He was also placed on three years’ probation.

But after he was released, Billingsley attacked someone else and was convicted and sentenced to two years (no time suspended) for that crime. Billingsley was also convicted of a probation violation and given an additional three years.

Billingsley’s accumulated time should have had him behind bars in June 2013 when he committed rape. But under Maryland’s system, he did a small fraction of his due incarceration, leaving him free to prey on others.

For the 2013 rape, Billingsley received 30 years with 16 years suspended. The judge in the case expressed consternation at the 14-year sentence, but under Maryland law, judges can only reject or affirm a prosecutor’s binding plea agreement. If the court had rejected that agreement, Billingsley might have walked altogether because the victim did not want to testify.

The Baltimore Banner thanks its sponsors. Become one.

The frustrated judge warned the defendant: “If you violate probation you should expect to get a substantial portion of the balance [of the suspended 16 years] of this sentence. Do you understand, sir?”

But Maryland’s system — as Billingsley’s earlier cases and violations illustrate — often doesn’t reimpose suspended time. Billingsley also earned another 1 1/2 years off his sentence for the time he served in jail awaiting sentencing.

His repeated violent acts and probation violations notwithstanding, Billingsley should have served until July 2027. Instead, he was released in October 2022 and is now accused of committing two new and savage crimes.

That’s because under Maryland law, even repeat violent offenders like Billingsley can get further time off through “diminution credits” for merely not violating prison rules (good conduct) or completing rudimentary tasks. Sex offenders such as Billingsley have received 10 days off their sentences per month for good conduct, and up to 20 total per month for attending classes or performing work.

Despite being denied release by the parole board twice, Billingsley received enough diminution credits to secure automatic release almost five years early.

The Baltimore Banner thanks its sponsors. Become one.

Under Maryland’s accounting system, five years can mean two months, three more years can mean a few months and 30 years can translate to really only nine.

Bates and Scott are right that Billingsley should not have been on the street. But it wasn’t a person’s or agency’s fault. The system worked as designed.

Sadly, Maryland’s criminal justice system was working as intended and resulted in more unnecessary victims.

Jason Johnson is a former deputy commissioner of the Baltimore Police Department (2016-2018) and president of the Law Enforcement Legal Defense Fund.

More From The Banner