Leave to appeal the ruling will be sought at the court of appeal on Thursday. Tammy Samede, as the principal named defendant, said outside the court: "This is not the end. Onwards and upwards for Occupy."

Her QC, John Cooper, said an appeal would be sought on whether the actions taken by the corporation were proportionate.

"This is an important judgment. It marks the start of a legal analysis as to the extent of protest in this country. What Occupy have done is push the boundaries of public law on protest," said Cooper.

The judge, Mr Justice Lindblom, said he ruled in favour of the corporation because of the extent and duration of the tented protest at St Paul's, the public nuisance it caused, and the effect on worshippers and visitors.

Granting orders for possession and injunctions against Occupy London Stock Exchange (LSX), he said the proposed action was "entirely lawful and justified" as well as necessary and proportionate. But he praised OccupyLSX protesters, who set up camp on 16 October to highlight global economic injustice, for the way they had conducted their legal case. "No one has doubted, or could, the significance of the causes the defendants promote, or the sincerity and passion with which they are doing this." He refused permission to appeal, although the protesters have seven working days to seek leave to challenge the decision. The corporation has said it will not enforce eviction until leave to appeal has been sought.

In a statement he said: "This judgment is disappointing. In a world where there is such a gap between rich and poor, the voice of protest needs continually to be heard. The church must not be seen to side with the 1% rather than the 99%."

George Barda, 35, one of three named defendants, said: "It's disappointing but predictable."

He said of the five-day hearing before Christmas, during which he gave evidence: "It was a fairly lengthy hearing, but there was hardly any listening."

The corporation's lawyers told the judge it was their "sincere and genuine hope" that the OccupyLSX protesters would leave with dignity when the time came, and with no need for enforcement.

Michael Paget, counsel for OccupyLSX, said the appeal would be sought on the grounds that the injunction was too far-reaching. He said the corporation had accepted people could protest at the cathedral every day. "So the real issue is, should they be there overnight?" But Lindblom rejected that definition of a "semi-permanent" camp.

The corporation had said there was an overwhelming case for the court's intervention because of the impact on the churchyard of the camp. The limited interference with the protesters' rights entailed in the removal of the tents was justified and proportionate, given the rights and freedoms of others, it argued.

The corporation's lawyers had told Lindblom, who visited the camp during the hearing, that it acted as a magnet for disorder and crime in the area, impacted on worshippers, affected trade and caused waste and hygiene problems.

"The freedoms and rights of others, the interest of public health and public safety and the prevention of disorder and crime, and the need to protect the environment of this part of the City of London all demand the remedy which the court's orders will bring," said Lindblom in his lengthy judgment. The City had no "sensible" choice but to take action.

"Conscious of its duties under statute, it gave the defendants an ample opportunity to remove the protest camp without the need for time and money to be spent in legal proceedings."

Praising the protesters for their conduct during the hearing, he said: "Whilst I recognise that this outcome will be disappointing to the defendants, I wish to pay tribute to all who participated in the hearing for the courteous and helpful way in which they conducted themselves."

Stuart Fraser, the corporation's policy chairman, said: "We took this action to clear the tents and equipment at St Paul's. We hope the protesters will now remove the tents voluntarily. If not, and subject to any appeal proceedings, we will be considering enforcement action as soon as possible."

The Liberal Democrat MEP for London, Sarah Ludford, said it was the right decision. "Protests should not morph into tent cities. The right to protest is too precious to be undermined by long-term encampments which disrupt normal life to an unacceptable extent, beyond the inevitable and legitimate inconvenience of a one-off demo."

The bishop of London, the Rt Rev Richard Chartres, said: "Whatever now happens as a result of today's judgment, the protest has brought a number of vital themes that the St Paul's Institute remains committed to exploring and, now through London Connection, we want to ensure they continue to have a voice."