By Ian Dunt Follow @IanDunt and Alex Stevenson Follow @alex__stevenson

The high court overturned the prisoner book ban today, in a humiliating ruling for justice secretary Chris Grayling.

The ban, which was originally reported by Politics.co.uk, barred prisoners from being sent books in parcels as part of a tough Incentives and Earned Privileges scheme.

The policy must now be amended so that it excludes prisoners receiving books from friends and family.

In a damning judgement, Mr Justice Collins said that as far as books are concerned, "to refer to them as a privilege is strange".

He also criticised Grayling for the "absurd" rules of the IEP and said his public comments about the controversy were "misleading".

Prisoner book ban judgement: Grayling's views found to be 'absurd' and 'strange'

The Ministry of Justice claimed that there remained adequate access to prison libraries and that prisoners could buy books with their own money, but that argument was rejected by the court.

It heard that prisoners often earn as little as £2.50 a week, from which they must also pay for toiletries and amenities.

Libraries are often hard to access because cuts to prison officer staffing levels leave few available to walk inmates to them. They are also often inadequately stocked.

"I see no good reason in the light of the importance of books for prisoners to restrict beyond what is required by volumetric control and reasonable measures relating to frequency of parcels and security considerations," the judge said.

The policy must now be amended so that it excludes prisoners receiving books from friends and family.

"The ban on sending books to prisoners was always an absurd policy," shadow justice secretary Sadiq Khan said.

"It had nothing to do with punishing and reforming prisoners but was an example of David Cameron's government's sloppy policy making.

"This is a victory for all those who campaigned against the ban and the government should abandon the ludicrous policy with immediate effect."

In his damning judgement, Mr Justice Collins said that as far as books are concerned, "to refer to them as a privilege is strange".

"We now call on the Ministry of Justice to relax the ban on sending in parcels completely so that prisoners can receive essentials such as underwear and small gifts from their children," the Howard League for Penal Reform's chief executive Frances Crook said.

"This would help to alleviate distress in prisons at a time when they are in crisis."

She suggested better access to books could "literally save a life" as prisoners face three weeks of virtual lockdown over Christmas.

"The government should overturn the restrictions with immediate effect," English PEN director Jo Glanville commented.

"Its reluctance to address the issue, despite the public outcry and support of leading authors over the past year, has been short-sighted and self-defeating."

Lawyers pointed out that the case would have been much harder to bring if Grayling had already forced through his changes to judicial review, which return to the Lords next Tuesday.

Even under the current rules, there was no legal aid available and lawyers acted pro bono.

The four people challenging the prisoner book ban were vastly outnumbered by the MoJ's legal team, which had solicitors, barristers and plenty of civil servants to back them up.

Shadow justice minister Andy Slaughter said: "Labour have pledged to reverse the prisoner book ban and now it looks like the High court agree. Grayling's attempt to put obstacles in the way of prisoners being able to read books has been exposed as ludicrous.

"This is another case of the government being beaten in the courts with judicial review. No wonder that last Monday coalition MPs voted to effectively neuter it."

One of the themes of the case was that if people knew the full state of affairs in prisons they'd be angrier than they already are. For instance, women are only allowed seven pieces of bras and underwear. This type of arbitrary pointless restriction was a constant feature of the trial.

But the case turned on whether the policy did what it was intended to do. If a policy is introduced with a purpose and it does not meet that purpose, a previous case from 1968 against the minister for agriculture, fisheries and food provides the precedent for judges to make an unlawful ruling.

That is what happened today. Mr Justice Collins found the "virtual ban" was unlawful because it contradicted Grayling's public comments about the importance of books being useful for education and rehabilitation.

The Prison Service said it viewed the judgement as "surprising".

"There never was a specific ban on books and the restrictions on parcels have been in existence across most of the prison estate for many years and for very good reason," a spokesperson said.

"Prisoners have access to the same public library service as the rest of us, and can buy books through the prison shop.

"We are considering how best to fulfil the ruling of the court. However, we are clear that we will not do anything that would create a new conduit for smuggling drugs and extremist materials into our prisons."