JACKSON, Miss. (AP) — The Mississippi Supreme Court’s confirmation of a 12-year prison sentence for an African American man who carried his mobile phone into a county jail cell is being slammed as a brutal example of racial injustice.

Even one of the justices who joined in the unanimous ruling said that while the sentence is legal, the prosecutor and trial judge could have avoided punishing the man entirely.

Justice Leslie King is currently the only African American justice on the nine-member court. He wrote that Willie Nash’s case “seems to demonstrate a failure of our criminal justice system on multiple levels” because it’s not clear whether Nash was properly searched or told not to take his phone into his cell when he was booked on a misdemeanor charge.

A 2012 Mississippi law sets a sentencing range of three to 15 years for inmates found with deadly weapons, cellphones or components of cellphones in state jails and prisons.

Sentencing reform advocates have expressed outrage, and Leonard Pitts, a nationally syndicated Miami Herald columnist, published Gov. Tate Reeves’ phone number, urging readers to tell the newly inaugurated governor to “let my people go.”

Nash, now 39, didn’t seek to overturn his conviction, but argued on appeal that his August 2018 sentence was grossly disproportionate, violating the constitutional ban on cruel and unusual punishment.

Mississippi justices unanimously rejected his argument.

“Though harsh, Nash’s sentence falls within the statutory range,” Justice James Maxwell wrote for the high court on Jan. 9.

A 2012 Mississippi law sets a sentencing range of three to 15 years for inmates found with deadly weapons, cellphones or components of cellphones in state jails and prisons.

Corrections officials have said for years that contraband cellphones are a problem in the state’s jails and prisons. During an outbreak of violence that left five inmates dead and an undisclosed number of other inmates injured between Dec. 29 and Jan. 3, some inmates used cellphones to take photos and videos that showed, among other things, prisoners sleeping on the floor of a crowded cell and smoke filling a corridor and cells at the Mississippi State Penitentiary at Parchman.

In Nash’s case, court records show he asked an employee at the Newton County jail for “some juice” and then willingly handed over his phone. The employee thought Nash wanted something to drink at first, before realizing that he wanted electricity to power the device.

The jailer gave the phone to a deputy sheriff, who later unlocked it using the pass code Nash provided. The deputy found the phone had photos and messages belonging to Nash.

The trial judge told Nash to “consider yourself fortunate” in getting the 12-year sentence, because Nash had previous burglary convictions and could have been sentenced as a habitual offender to the full 15 years without the possibility of early release. The Supreme Court noted that Nash could get out after serving 25% of his sentence, or three years.

King wrote that Nash’s case is an example of why prosecutors and judges have “wide discretion.”

“Nash served his time for his previous convictions and stayed out of trouble with the law for many years,” King wrote. “He has a wife and three children who rely on him. His crime was victimless, and the facts of the case lend themselves to an interpretation that his crime was accidental and likely caused by a failure in booking procedures.”

“Nash did not do anything nefarious with his phone, and he certainly did not hide his phone from law enforcement,” King added. “Both the prosecutor and the trial court should have taken a more rehabilitative, rather than punitive, stance.”

Cliff Johnson, director of the MacArthur Justice Center at the University of Mississippi law school, said Thursday that the problem with the Nash case comes from decisions made in the local trial court. Johnson said lawmakers set a wide sentencing range for jail contraband cases, but that does not force prosecutors and judges to go for the harshest punishment.

Mississippi has one of the highest incarceration rates in the U.S.

“Anybody who thinks there’s not a connection between sentences like this and the recent violence in our prisons hasn’t been paying attention,” Johnson told The Associated Press.