A prisoner who was held in solitary confinement for two years has been awarded \$15.5m (£10.3m) in compensation.
A court in southern New Mexico reached the record settlement to end Stephen Slevin's long-running legal battle over the case.
The payout - one of the largest federal civil rights settlements in history - stems from mediation ordered by a federal appeals court.
Dona Ana County had appealed against a lower court decision to uphold the original \$22m (£14.6m) judgement that was awarded last January.
According to the 58-year-old's lawsuit, he spent 22 months in jail after being arrested for drink-driving in 2005.
He was never brought before a judge nor convicted of any crime.
But he was so neglected that his toenails curled around his foot and he developed fungus on his skin because he was deprived of showers.
He eventually took out his own tooth.
His physical and mental health continues to deteriorate under the strain.
He now has lung cancer but is currently beating the doctors' odds for his survival.
"Why they did what they did I'll never know," Mr Slevin told KOB4-TV outside the court.
"Walking by me, watching me deteriorate day after day after day, and they did nothing at all to get me help."
The county's board of commissioners said in a statement that it regretted the harm Mr Slevin suffered while in custody.