Three protesters jailed for blocking access to a fracking site have walked free after the court of appeal quashed their sentences, calling them “manifestly excessive”.

Simon Blevins, 26, Richard Roberts, 36, and Rich Loizou, 31, were sent to prison last month after being convicted of causing a public nuisance with a protest outside the Preston New Road site near Blackpool, Lancashire. Blevins and Roberts were sentenced to 16 months and Loizou to 15 months.

But on Wednesday afternoon the court of appeal ruled their sentences were inappropriate and they should be freed immediately. Soon after, the trio walked free from Preston prison, where they were greeted with hugs and cheers from dozens of supporters.

To applause from the crowd, Loizou said: “If people break the law out of a moral obligation to prevent the expansion of fossil fuel industries they should not be sent to prison.

The fracking protesters did us a public service. Jailing them was wrong | Michael Segalov Read more

“The fracking industry threatens to industrialise our beautiful countryside. It will force famine, flooding and many other disasters on the world’s most vulnerable communities by exacerbating climate change.

“Fracking is beginning right now, so there has never been a more critical time to take action. Your planet needs you.”

He urged people to join a mass demonstration at the Preston New Road site on Saturday.

Facebook Twitter Pinterest Left to right: Rich Loizou, Simon Blevins and Richard Roberts. Photograph: Lancashire Constabulary/PA

Questions over the original trial judge’s family links to the oil and gas industry were also raised in court on Wednesday. Judge Robert Altham’s father and sister run JC Altham and Sons, a company believed to be part of the supply chain for energy giant Centrica, which has invested tens of millions of pounds in fracking.

The judicial conduct investigations office later confirmed it had “received a complaint regarding HHJ Robert Altham, which will be considered in accordance with the judicial conduct (judicial and other office holders) rules 2014”.

It was Altham who, after a four-week trial at Preston crown court in August, sentenced Blevins – a soil scientist from Sheffield, Roberts – a teacher from London, and Loizou – a piano restorer from Devon – to significant custodial sentences, making them the first anti-fracking protestors to be imprisoned.

The three men had climbed on to lorries outside Cuadrilla’s fracking site in a protest last July that lasted almost 100 hours.

A fourth activist, Julian Brock, 47, was sentenced to 12 months in custody, suspended for 18 months, after he admitted public nuisance over the same protest. Brock did not challenge his sentence.

The three men were granted an expedited appeal amid widespread anger at punishments that were held to be “excessive and extraordinary” for peaceful protesters. They were supported by Friends of the Earth and Liberty, which warned the case could have a chilling effect on future protests.

Giving the panel’s decision at the Royal Courts of Justice in London, the lord chief justice, Lord Burnett of Maldon, said: “We have concluded that an immediate custodial sentence in the case of these defendants was manifestly excessive.

“In our judgment the appropriate sentence was a community order with a significant requirement of unpaid work. But these appellants have been in custody now for two weeks, the equivalent of a six-week prison sentence. As a result, and only for that reason, we’ve concluded that the only appropriate sentence is a conditional discharge for two years.

“We quash the imprisonment sentence.”

The packed courtroom erupted with applause and some supporters began singing after the decision was announced, while Blevins, Roberts and Loizou, who appeared via video link from prison, hugged each other and punched the air.

Loizou’s father, Platon, said: “Justice has been done today. We shouldn’t be here in the first place, but justice has been done.”

Acting for the three, Kirsty Brimelow QC, the head of the human rights team at Doughty Street Chambers, said the sentences were both excessive and wrong in principle for a peaceful protest that was overwhelmingly backed by local people.

“Rights worth having are unruly things,” she said, citing a previous ruling. “Demonstrations and protests are liable to be a nuisance, they are liable to be tiresome, or they are likely to be perceived as such by people who are out of sympathy for them.”

In the original case, Altham had cited the disruption caused by the protests as one of the reasons for such stiff sentences. But Brimelow said the prosecution’s claim that they had caused serious disruption was not supported by evidence.

Facebook Twitter Pinterest Protesters outside the Royal Court of Justice in London. Photograph: Cathy Gordon/PA

She noted that as proof of the disruption, prosecutors had mentioned that a delivery of maggots had to be delivered on foot to a nearby aquarium. “This was as serious as it got, that they had to wheelbarrow some live maggots into World of Water, rather than drive a truck.”

It also emerged in the hearing that Altham had refused the defendants an opportunity to bring a defence of necessity in their original trial.

“The judge explicitly stated pre-trial he would not hear any evidence about fracking,” Brimelow said, explaining that such a restriction prevented her clients from bringing arguments relating to their rights to protest and free speech.

She added: “These men now have a criminal conviction, which will very much affect their future lives. In our submission that is enough, that is proportionate to what they did.

“What the judge has done is imprisoned these people for their views and for a peaceful protest and what’s happened as a result is that there has been a chilling effect on protest, and this is something that has not occurred for many, many years.”

Referring to the judge’s family links to the oil and gas industry, Brimelow told the court: “He should not have sentenced, because there is sufficient evidence here to raise apparent bias.” She pointed to a letter signed by Altham’s sister in 2014 that called on Lancashire council to approve fracking.

However, Burnett said he would not accept Altham’s potential for bias as grounds in the appeal, saying the issue needed further investigation and a response from Altham.

Liberty hailed the court’s decision as a victory for human rights and civil liberties. Emma Norton, its head of legal casework, said: “Civil disobedience plays a vital role in safeguarding our democracy and we are delighted the court of appeal has recognised and protected the rights of these protesters, who should never have been in prison.”

Jeremy Corbyn pledged that a Labour government would ban fracking. “I welcome the decision to quash the unjust sentences of fracking protesters,” he said. “We stand in solidarity with the activists and thank them for standing up to the further destruction of our environment by this Tory government.

• This article was amended on 18 October 2018. An earlier version stated that the three protesters were the “first people to be imprisoned for an environmental protest since 1932”. This has been changed to “the first anti-fracking protesters to be imprisoned”. To clarify: the claim that the men would be the first environmental activists to be jailed for a protest since 1932 was made in argument in the earlier court hearing by one of the defence lawyers.