Image caption Herman Wallace is suffering from liver cancer

The murder conviction of a prisoner who has spent 41 years in solitary confinement has been overturned by a judge in the US state of Louisiana. What is it like being kept in total or near total isolation?

Herman Wallace worked out, read Black Panther literature and fought the system. This week "the Muhammad Ali of the criminal justice system" was released.

Wallace was in a nursing clinic at Hunt Correctional Centre in St Gabriel, Louisiana, on Tuesday morning when he heard the news - and was understandably sceptical.

"I said, 'Herman, you are a free man,'" says Carine Williams, one of his lawyers. A judge had reversed his 1974 conviction for murder.

"He said, 'No, I'm not. I know where I am,'" she says. He looked around the room at the prison.

On that day in the clinic - he has liver cancer - he maintained his composure. It is a survival skill that he has honed over decades in prison.

He was serving a sentence for armed robbery in Louisiana State Penitentiary in Angola. He and another inmate, Albert Woodfox, were convicted in the stabbing death of a prison guard, Brent Miller, in April 1972.

Image caption Wallace was released - and taken to a hospital

Wallace and Woodfox were placed in isolation - Wallace was first in Angola and later in St Gabriel. It is a punishment that "devours victims incessantly and unmercifully", according to Alexis de Tocqueville, the author of Democracy in America.

It remains part of the prison system. More than 81,000 prisoners are held in solitary confinement in the US, said Senator Richard Durbin in a June 2012 hearing on the subject, citing a report by the Bureau of Justice Statistics.

Some prisoners are placed in solitary confinement because they have assaulted or killed another inmate or a guard. Others are held there because they are gang members - and are considered dangerous.

Prisoners in solitary confinement are held in their cells on "average 23 hours a day", according to Craig Haney, a University of California professor who testified at the June 2012 hearing.

"Prisoners go for years - in some cases for decades - never touching another human being with affection," he said. "The emptiness and idleness that pervade most solitary confinement units are profound and enveloping."

The emptiness and idleness that pervade most solitary confinement units are profound and enveloping Craig Haney, University of California

Some prisoners in solitary confinement commit suicide. Others hurt themselves. One man in New Mexico, said Haney, "used a makeshift needle and thread from his pillowcase to sew his mouth completely shut".

Last summer 30,000 California prisoners went on a hunger strike to protest against solitary confinement. State lawmakers said they would examine the issue - and the strike was cancelled. Years ago, inmates at the Angola prison were disturbed at the way that Wallace and others were treated in their isolated cells.

Wilbert Rideau, who was an Angola inmate at the time, says: "We knew there was a place called CCR", an acronym that stood for Close Custody - Restricted, the place where Wallace and others were held.

"We just didn't know how long they were in there," says Rideau.

Rideau, the editor of a prison magazine called The Angolite, did some research. He discovered Wallace had been isolated for more than 15 years. The Angolite published a feature about him and others in solitary confinement, says Rideau.

Image caption Wallace created this for a film called Herman's House

Until that point, Wallace and the other men in solitary confinement were basically "unknown to the world", says Rideau, the author of a memoir, In The Place of Justice. Wallace told one of his lawyers, George Kendall, that "this is the cruellest thing one man can do to another".

Wallace's friend Woodfox, who is still in solitary confinement, helped him fight the loneliness. "He told him, 'Remember our motto: always far apart but never not together'," Williams says.

In a six-by-nine-feet cell - just under three metres by two - Wallace stayed in shape by lifting weights that he constructed out of old newspapers. For a film entitled Herman's House, Wallace created a dream house he would someday live in. He read material about the Black Panther Party, a 1960s revolutionary group - and anything else he could get his hands on, and kept up with current events.

"I would say, 'What's going on in the Middle East?' and he would say, 'OK, which country do you want to talk about?'" says Kendall.

Wallace replied to letters - he got a steady stream of mail - and worked on his appeal. "This man is the Muhammad Ali of the criminal justice system. He just would not quit," Williams says.

By many accounts, the evidence against him and the other inmate was weak. They did not leave fingerprints at the place where Miller was killed, for instance. Even Miller's widow, Teenie Verret, said she had doubts about the case against them - and hoped they would be treated fairly.

This is the cruellest thing one man can do to another Herman Wallace

"If they did not do this, I think they need to be out," she said on NBC Nightly News in March 2008.

In recent weeks, Wallace has begun to feel increasingly weak. When Kendall visited him in the medical clinic, he noticed a three-inch stack of letters on a food tray.

"He said, 'I need to write them back.' He felt very bad about that," says Kendall.

On Tuesday evening, Williams rode with Wallace in an ambulance to the edge of the prison grounds. It pulled up to a stop sign. She told him she was going to get out - and would see him later that evening.

"I'm like, 'Are you all right?' He said, 'I'm good. Just get me out of here.'"

He was taken to an emergency room at LSU Interim Hospital in New Orleans. By that time he could barely talk. "You could see him struggling," says Williams. "Every word was precious."

He had something he wanted to say, though. "He said, 'I'm free'", she recalls. "He said it again three or four times."

Herman Wallace died of liver cancer on 4 October, three days after he left prison.