Christians and politicians reacted with dismay as the High Court today outlawed the centuries-old tradition of formal prayers being said at the start of local council meetings up and down the country.

The National Secular Society and an atheist ex-councillor won a test case ruling that Bideford town council, Devon, was acting unlawfully by putting prayer on meeting agendas.

It is understood the ritual dates back in Bideford to the days of Queen Elizabeth I, and the council has recently voted twice to retain it.

But Mr Justice Ouseley, sitting in London, ruled local councils lacked power under section 111 of the Local Government Act 1972 to hold prayers "as part of a formal local authority meeting".

However it was lawful for prayers to be said "in a local authority chamber before a formal meeting", provided councillors were not "formally summoned to attend".

He added: "I do not think that the 1972 Act dealing with the organisation, management and decision-making of local councils should be interpreted as permitting the religious views of one group of councillors, however sincere or large its number, to exclude or, even to a modest extent, impose burdens on or mark out those who do not share their views and do not wish to participate in their expression.

"They are all equally-elected councillors."

The council said its last formal prayers on the eve of the judgment. The brief ritual took the form of "two minutes of reflective silence" conducted by a Quaker.

Acknowledging the widespread importance of a decision that surprised many, the judge gave the council permission to appeal.

Communities Secretary Eric Pickles described it as "surprising and disappointing" - and queried whether the judge had got the law right.

Mr Pickles said: "Christianity plays an important part in the culture, heritage and fabric of our nation.

"The Localism Act now gives councils a general power of competence - which allows them to undertake any general action that an individual could do unless it is specifically prohibited by law. Logically, this includes prayers before meetings."

Sir Merrick Cockell, chairman of the Local Government Association, said: "It is the LGA's view that this ruling will be overridden by the 'general power of competence' as soon as the legislation comes into force and that it remains the decision of local authorities if they wish to hold prayers during formal meetings."

The general power of competence is part of the Localism Act and is designed to give local authorities the legal capacity to do anything an individual can do that is not specifically prohibited by law.

Simon Calvert, of the Christian Institute, said: "Prayers have been a part of council meetings for centuries, and many people, either for religious reasons or cultural reasons, see them as a positive part of our national life.

"It's a shame the courts have taken sides with those whose goal is to undermine our Christian heritage."

He called on Parliament to "stop this assault upon our national heritage".

But the judgment affecting councils all over England and Wales was welcomed by the National Secular Society as "an important victory for everyone who wants a secular society that neither advantages nor disadvantages people because of their religion or lack of it."

Keith Porteous Wood, the society's executive director, said: "There is no longer a respectable argument that Britain is a solely Christian nation, or even a religious one."

He said: "An increasing proportion of people are not practising any religion, and minority faiths are growing in number and influence."

Prayers had been the cause of tension in a number of multi-faith local councils.

The legal challenge was launched in July 2010 after the National Secular Society was contacted by Clive Bone - a non-believer who was then a Bideford councillor.

Mr Bone later left the council because of its "refusal to adjust" its prayer policy, which caused him embarrassment.

In court, the secularists' argument included assertions that prayers breached equality laws and articles nine and 14 of the European Convention on Human Rights, which protect an individual's right to freedom of conscience and not to face discrimination.

But the judge rejected the human rights and equality challenges. He ruled formal prayers were only unlawful because the council lacked the statutory power to put them on the agenda.

Bideford town clerk Heather Blackburn later expressed "surprise and disappointment" and said an appeal was being considered.

The Bishop of Exeter, the Rt Rev Michael Langrish, condemned the ruling.

He told the BBC: "Every time there is a survey of religious beliefs in this country, around 70% of the population profess a faith and to saying private prayers.

"At the House of Lords we began with prayers this morning. Prayers were said by a considerable amount of peers. I don't think you will find anyone in the House of Lords who will seriously suggest we should end that practice."

Harry Greenway, a former Tory MP and ex-chairman of the National Prayer Breakfast, said: "I trust this ruling will be quickly reversed. If people do not want to attend prayers of this nature, they can stay away instead of meddling and busybodying with other people's beliefs.

"If they did away with daily prayers in the House of Commons - and I would not be surprised if an attempt is made to do that - there would be a revolution.

"Non-believers are not harassed in this way by believers. Why cannot the non-believers show the same kind of tolerance? I find this ruling puzzling in the extreme."

A spokesman for the Equality and Human Rights Commission said: "We note that the human rights arguments in this case have been rejected by the judge.

"We think it unfortunate that a compromise couldn't be reached on this matter, without resorting to legal action."