A legal challenge by 13 prisoners still being detained years after the expiry of their minimum sentences has been rejected by senior judges.
Their sentences of "imprisonment for public protection" (IPP), with minimum terms of six months to five years, were imposed between 2005 and 2008.
The court ruled the sentences had been lawfully imposed and said it was up to Parliament to remedy any injustice.
IPP sentences came in for England and Wales in 2005 but were axed in 2012.
Ministry of Justice data shows 3,391 people out of the 4,289 given such terms before the sentences were abolished are still being held.
The cases being considered by the Court of Appeal involved defendants jailed for child sexual abuse, robbery, manslaughter, rape, arson and causing death by dangerous driving.
In their ruling, Lord Chief Justice Lord Thomas and two other judges accepted the minimum terms imposed in the cases had "long expired".
But they said it was not possible to set aside sentences that had been "properly and lawfully passed".
Lord Thomas said: "We are mindful of the substantial criticism that, many years after the expiry of minimum terms, sometimes of a very short period, many sentenced to IPP remain in custody or have been recalled to custody for breach of their licence conditions."
The effect of long-term imprisonment with no certain release date, added Lord Thomas, might "increase the likelihood of reoffending".
Under IPP sentencing, a judge passed a tariff, or minimum term. An offender would not be released if the Parole Board considered them to still to be a risk.
Lord Thomas suggested Parliament could provide resources to enable those detained to meet the Parole's Board's "release test"; alter the release criteria itself, or re-sentence those in custody under new principles.