The Government could be forced into a climbdown over its cuts to legal aid for prisoners after the "groundbreaking" judgement that they were unlawful at the Court of Appeal.

Violence and self-harm in prisons have soared to record levels since they were imposed by former Justice Secretary Chris Grayling in December 2013 and and almost 300 prisoners have committed suicide.

Many have also been unable to challenge decisions that could keep them incarcerated for longer than necessary.

But following an appeal by the Howard League for Penal Reform and the Prisoners’ Advice Service, three judges found denying inmates legal aid is “inherently unfair” because of the vulnerability of some prisoners and their inability to represent themselves.

The judgement paves the way for judicial review.

In pictures: The view from inside Wandsworth Prison Show all 10 1 /10 In pictures: The view from inside Wandsworth Prison In pictures: The view from inside Wandsworth Prison 'Most of the Inside Eye teachers come from a photojournalistic background and a large part of what we hoped for in the growing body of work was a document of life in prison. We encouraged the photographers to get inside prison life. Kris Allen had been talking to the inmate (pictured) and he was suddenly overcome with emotion. This powerful image embodies so much of what we set out for our photographers to achieve when we conceived Inside Eye.' © Kris Allen. Inside Eye In pictures: The view from inside Wandsworth Prison 'A prisoner in his cell was talking to the photographer outside and they came up with this simple and graphic gesture.' © Marc Carolissen. Inside Eye In pictures: The view from inside Wandsworth Prison Chairs 'This is just a stack of chairs until it is photographed well. The boredom and routine inside the prison could keep a photographer from seeing photographic possibilities. Finding and isolating a subject to photograph, making it noteworthy or even extraordinary was a big part of the teaching.' © Mohamed Manssor. Inside Eye In pictures: The view from inside Wandsworth Prison 'An image of one of the prison wings, showing all three stories and the large windows at the far end. Inmates are confined to their cells for certain periods of each day. However, the nearest doorway on the left is open, as seen by the light on the floor coming from inside the cell. ' © Unknown. Inside Eye In pictures: The view from inside Wandsworth Prison Broken Furniture on Wing 'As teachers we were given a set of keys to the prison on teaching days and often we were able to take the photographers into the various areas of the prison. One of the unique aspects of the Inside Eye project was that some inmates from the main prison were allowed to work with inmates in the Vulnerable Prisoners Unit where we had the darkroom and work area. On a trip into the main prison the photographer found the total chaos of a wing under refurbishment.' © Joe. Inside Eye In pictures: The view from inside Wandsworth Prison The Prisoner's Needs The lighter is made from a piece of wood and the striking mechanism is from a disposable lighter. Obviously, no flammable materials are allowed inside. Strands from a clean mop are pushed up through a hole in the wood handle and the sparks ignite the cotton, giving just enough glow to light a cigarette. © Michael Inns. Inside Eye In pictures: The view from inside Wandsworth Prison Bread and Water © Kris Allen. Inside Eye In pictures: The view from inside Wandsworth Prison Exercise Yard Inmates captured out in the exercise yard, they can only walk around the yard in one direction, counter clockwise. © Michael Inns. Inside Eye In pictures: The view from inside Wandsworth Prison Stairs 'The graphic quality of the Victorian architecture of Wandsworth Prison is seen in the three-story windows and cast iron stairs at the far end of one of the wings.' © Michael Inns. Inside Eye In pictures: The view from inside Wandsworth Prison Putting cameras in the hands of inmates was unprecedented. The prison officers were not cooperative at first even though the chief Governor supported Inside Eye. Very few officers allowed themselves to be photographed. So the photographer did well to get these two in shot. © Kris Allen. Inside Eye

"The evidence about prison staffing levels, the current state of prisons, and the workload of the Parole Board suggests that the system is under considerable pressure," said Lord Justice Beatson in his judgement, adding: "The system has at present not got the capacity sufficiently to fill the gap in the run of cases (where legal aid is being denied).”

Before his ruling, the court heard that inmates who might be suitable candidates for open prison or re-categorisation are currently unable to access legal aid and may be forced to remain as Category A prisoners for years longer than necessary.

Prisoners were also left without representation for sentencing reviews by the Parole Board and for decisions about access to offender behaviour programmes and courses, disciplinary proceedings and placement in close supervision centres.

The court found the “high threshold" for a finding of systemic unfairness has been satisfied in the case of pre-tariff reviews by the Parole Board, Category A reviews and decisions as to placement in a close supervision centre.

The judgement said the court considered “the ability of the individual to represent himself without legal assistance, having regard to his age or mental capacity” and that it considered “vulnerable prisoners” such as those with learning disabilities and mental illness, in reaching its decision.

The judgement was welcomed in a joint statement by the prisoners’ charities who lodged the appeal.

Frances Crook, Chief Executive of the Howard League for Penal Reform, said: “This decision will make the public safer. It vindicates our concerns that cuts imposed by the former Lord Chancellor, Chris Grayling, in 2013 presented a grave risk that prisoners would become stuck in a broken system.

“This sends a clear message that important decisions about prisoners cannot be made efficiently or fairly in the face of these cuts. We look forward to hearing from the Lord Chancellor with her plans to give effect to the judgement.”

Deborah Russo, Joint Managing Solicitor of the Prisoners’ Advice Service, said: “This is an unprecedented and groundbreaking legal victory in which the vulnerability of the prison population is fully recognised as a key factor in its limited ability to access justice. Common law came to the rescue of a marginalised and often forgotten sector of our society.”

When he introduced the cuts to legal aid, Mr Grayling said the restrictions represented a “good deal” for taxpayers as the coalition Government sought to reduce the legal aid bill by £350 million a year as part of sweeping public spending cuts. His successor, Michael Gove, reversed some of the proposed cuts to legal aid, but not for prisoners.

Mr Grayling said in 2013 he was “appalled” taxpayers’ money was being used for legal cases which he claimed should be dealt with by the prison system’s internal complaints system.

In 2013, prisoners were bringing approximately 11,000 court cases each year but the cut meant only wealthy prisoners could continue to have legal representation where they didn't agree with the decision of authorities such as the Parole Board.

Deborah Russo, Joint Managing Solicitor of the Prisoners’ Advice Service, hailed the ruling as a landmark one.

“This is an unprecedented and groundbreaking legal victory in which the vulnerability of the prison population is fully recognised as a key factor in its limited ability to access justice. Common law came to the rescue of a marginalised and often forgotten sector of our society.”

Rebecca Hilsenrath, Chief Executive of the Equalities and Human Rights Commission, which intervened in the case, said: “It’s a hallmark of a democratic legal system is that it is fair and robust for all users. Without access to legal aid, prisoners with learning difficulties and mental illness would not be able to participate effectively in important decisions about their future, placing them at a significant disadvantage. We welcome today’s judgment that will ensure our legal system continues to provide legal help during these hearings.”