Washington CNN  — 

Tensions concerning prison conditions flared up at the Supreme Court on Thursday, as Justice Anthony Kennedy chose to stray from the merits of a case at hand to question the use of the solitary confinement in prisons.

At issue was a complicated case concerning post-conviction relief of an inmate named Hector Ayala who was convicted of a triple murder. Kennedy voted with the majority against Ayala in the case at hand.

But something else caught Kennedy’s eye. He noted that Ayala had been sentenced to death in 1989 and served “the great majority” of his more than 25 years in solitary confinement.

“It is likely,” Kennedy wrote,” that Ayala has been held for all of most of the past 20 years or more in a windowless cell no larger than a typical parking spot for 23 hours a day; and in the one hour when he leaves it, he likely is allowed little or no opportunity for conversation or interaction with anyone.”

RELATED: Court strikes town sign ordinance challenge

Kennedy noted that there estimates that nearly 25,000 inmates in the United States are currently serving their sentence in solitary confinement and then cited literature and studies to press the point: “Years on end of near-total isolation exacts a terrible price.”

Kennedy cited side effects that include anxiety, panic, withdrawal, hallucinations, self-mutilation and suicidal thoughts. He suggested that the judiciary might be required to determine whether workable alternative systems for long-term confinement exist and if prisons should adopt them.

He mentioned by name Kalief Browder, the man arrested when he was 16 and held at Rikers – at times in solitary confinement – without being convicted of a crime.

READ: Man jailed as teen without conviction commits suicide

His story gained national attention when it was written about in The New Yorker.

Earlier this month Browder committed suicide, a death some linked to the trauma caused by his confinement.

Kalief Browder, who committed suicide June 6, 2015 after spending three years at Rikers Island.

it is not the first time Kennedy has expressed concerns with the state of prisons.

Justice Clarence Thomas wrote separately – again straying from the merits of the case – to respond, very briefly to Kennedy.

Thomas said that the “accommodations in which Ayala is housed” are a “far sight more spacious” than those in which his victims now rest.

“Given that his victims were all 31 years of age or under,” Thomas wrote, “Ayala will soon have had as much or more time to enjoy those accommodations as his victims had time to enjoy this Earth.”