The Guardian today lost a high court challenge to lift an emergency gagging order imposed on the publication of Barclays bank documents alleged to detail huge tax avoidance schemes.

A sheaf of internal memos from the bank's structured finance department were published on, and then withdrawn from, the Guardian website early on Tuesday morning after lawyers for the bank obtained an emergency temporary injunction from a judge to have them removed.

Barclays had argued that the publication of the material should be permanently suppressed in the face of arguments that there was a strong public interest for it to be disclosed.

The original gagging order was made by phone at 2.30am on Tuesday, by which time 127 people had accessed the files on the website. However, Barclays' counsel said that the documents' publication on the newspaper's website had led to them being picked up and published elsewhere.

The bank's QC, Charles Hollander, told the court that the documents were "confidential and privileged".

He said: "It is one thing to provide documents to the regulatory bodies nominated by parliament. It is quite another to submit them to the public."

Mr Justice Blake said today that the ban would remain in place for two reasons. First, he did not accept that all confidentiality had been destroyed after the documents had become available from other sources, particularly because this had been the result of the brief period in which they had appeared on the Guardian's website.

Second, he said that the Guardian was not entitled under the Human Rights Act to publish the complete, unexpurgated documents containing legal advice and other confidential matters. The more sensitive the data, he added, the more there is a responsibility on journalists to consider whether they are justified in publishing. Therefore, even though the subject of the way banks behave at present was important and acutely topical, he said he would maintain the ban on the Guardian publishing the documents, supplying them to others, or inciting their publication elsewhere.

"I can see no reason why the Guardian should not be able to make use of the contents of the documents," he said.

"Freedom of speech is a precious value in a democratic society, and one the courts must strive to protect and promote.

"However, that does not mean journalists should have complete freedom to publish confidential documents released in a breach of duty.

"If the debate can flourish without the publication of the full documents, that is a highly material factor."

The Guardian released a statement today explaining why it had decided to put the documents before the public.

"In publishing them the Guardian sought to shed light on the secret world of tax avoidance, the challenges facing HM Revenue & Customs, and the avoidance measures adopted by a bank which is currently seeking to gain direct support from British taxpayers," it said.

"Although the Guardian is prohibited from publishing the seven documents, in his judgment delivered today Mr Justice Blake confirmed that they are available elsewhere. He also recognised that the conduct of big business is a matter of topical public debate.

"The Guardian continues to believe that tax avoidance is a matter of high public and political interest and we will continue to revisit these issues and encourage the debate."

In arguments yesterday, the editor-in-chief, Alan Rusbridger, said he considered the documents to be "of the highest significance in the debate about tax avoidance".

After a lengthy secret session yesterday morning, a public hearing resumed and was told by Hollander that the banned documents were now "available elsewhere" as a consequence of their temporary publication on the Guardian's website.

Hugh Tomlinson QC, for the Guardian, had argued that Barclays' claim to confidentiality therefore fell at the first hurdle. He said: "The quality of confidentiality is lost if the information is available from other public sources."

The Guardian is prohibited from giving further details because of the order barring it from encouraging or inciting publication by anyone else of the contents of the seven internal Barclays memos, which describe plans for a variety of tax avoidance transactions.

The bank said further publication of its confidential tax-avoidance documents, stolen by a disaffected ex-employee, would damage its business by revealing Barclays "knowhow" and "global expertise gained over several years".

Barclays also said that the counterparties – other banks and financial institutions involved in the multibillion-pound loan transactions – "have expressed considerable displeasure that their names… have been published".

Some of the transactions in the documents were still operating, Barclays said.

The Guardian's counsel argued that these claims did not amount to evidence of any specific harm to Barclays, but were merely "a series of woolly generalities".

It was claimed yesterday on the bank's behalf that the public could still have a democratic debate about the desirability of Barclays' tax avoidance schemes, without being furnished with the specific facts in the documents.

But Tomlinson told the court it was a matter of journalistic judgment how much information the public needed in order to have a meaningful debate: "Abstract debate is sterile. It's quite another thing to look at precisely what they do in specific cases.

"The debate is brought to a proper focus if the general abstract points can be illustrated by the specifics. The specifics are to be found in these documents."

The public debate that should be had, he said, was: "Should major public companies be engaging in schemes of this sort? That is the public debate the Guardian has sought to contribute to over several weeks. It is of the utmost public importance."

Hollander responded that the Guardian, whom he had accused the previous day of "vigilante journalism", was "seeking to put themselves a little bit above the law".

He claimed the Guardian was "trying to usurp the statutory and regulatory process" by taking matters into its own hands instead of being content to have the documents studied by HM Revenue & Customs and the Financial Services Authority.

It was disclosed during the hearings that, although parts of the documents describing the loan transactions had been handed over to the Revenue for approval at the time, other parts had been deliberately withheld because they were confidential or protected by legal privilege.

These included the amounts of cash put aside as "provisions" in case partial payments had to be made after negotiation with the Revenue and the opinions from City law firms on the risk of Revenue challenge to aspects of their schemes. Vince Cable, Lib Dem shadow chancellor, has now sent full, unedited copies to the Revenue.

Counsel for Barclays said they hoped HMRC would abstain from reading the confidential parts.

Yesterday at the high court, Mr Justice Blake agreed to maintain the gag for the duration of the hearing.

After agreeing to Barclays' request to hold part of the hearing in secret, he also extended the injunction to prevent the Guardian from encouraging or inciting any publication by others.