- / Herman's House via AFP - Getty Images Herman Wallace at the Louisiana State Penitentiary in Angola in an undated photo. He was confined to solitary confinement for more than 40 years.

A former prisoner who had been free for only three days after serving more than 40 years in solitary confinement in Louisiana died Friday after a bout with liver cancer.

A federal judge on Tuesday ordered the immediate release of Herman Wallace, a member of the so-called "Angola 3," who served more time in solitary confinement than any other inmate, Wallace’s attorney George Kendall told NBC News.

Wallace, the former Black Panther who was only nine days away from turning 72 years old, died at a friend’s home with friends and family near his bedside, Kendall said.

“He was very comfortable and surrounded by loved ones,” said Kendall. “He was grateful that he was alive on free soil.”

The judge said on Tuesday that Wallace's petition was granted because women were excluded from the grand jury in his case four decades ago, violating the Fourteenth Amendment.

The state was given 30 days to notify Wallace if it planned to re-indict him, the court ruling said.

Originally serving time for unrelated cases of armed robbery, Wallace and fellow prisoner Albert Woodfox were convicted of the murder of a prison guard in 1972, and placed in isolation at the Louisiana State Penitentiary, also known as Angola Prison.

A third inmate, Robert King, was also convicted of murder, but his conviction was overturned in 2001, after 29 years of isolation.

Wallace and Woodfox, who have continued to deny involvement in the guard's killing, have been the subjects of documentary films. In July, Amnesty International called for their release on humanitarian grounds, claiming that "no physical evidence links them to the crime; potentially exculpatory DNA evidence has been lost, and the testimony of the main eyewitness has been discredited."

Welcoming the judge's decision, Wallace left the prison Tuesday night, Kendall said.

In a letter published in the San Francisco Bay View on Sept. 12, Wallace wrote that doctors had given him two months to live after they stopped his treatment altogether on Aug. 31.

Wallace died in a hospice-type setting, Kendall said, and added that Wallace “is a testament to the human spirit.

“He was determined that (solitary confinement) was not going to break him,” he said.

Woodfox's case is pending before the 5th U.S. Circuit Court of Appeals.

NBC's Becky Bratu contributed to this report.

Related