Prisoners ‘forgotten by the state’ on indefinite jail terms left emaciated, suicidal and disturbed, court told