Barclays faces a double blow to its reputation and finances after the government sought to retrieve more than 500 million pounds from banks by closing loopholes on highly abusive tax avoidance schemes.

Britain said it would close two aggressive tax avoidance schemes used by Barclays.

The criticism is hugely embarrassing for the bank, which has signed up to a voluntary code of practice not to engage in tax avoidance and whose boss, Bob Diamond, has said banks must win back trust from the public and be better citizens.

This will add a couple more years to the brand rejuvenation, said Ralph Silva, director at financial services research firm SRN.

The maths on this isn't a big issue, but reputationally it is not only that they aren't giving to society, but they will be seen as actually taking, he said.

Tax avoidance is not illegal, and Barclays said it had done nothing wrong and voluntarily alerted HM Revenue & Customs (HMRC) that it had bought back some of its own bonds in a tax efficient manner.

This was based on guidance from professional advisors that the treatment was both legal and compliant with the tax code, and given others had used a similar treatment, the bank said in a statement.

Barclays said it complies with the letter and spirit of tax laws and the code of conduct.

The Treasury's estimate that it will retrieve the payment of 500 million pounds refers to tax collected from all banks, a person familiar with the matter said.

Reuters on Monday estimated Barclays could have to pay about 120 million pounds after making 450 million pounds on a bond buyback deal in December.

The Treasury will retrospectively apply new laws from the start of December. Barclays said it will comply with the modified law, and the impact would not have a material impact on its profits.

Banks have made massive profits from buying back or exchanging their bonds, taking advantage of a fall in their market value. The process is known as liability management.

Royal Bank of Scotland and Lloyds, both partly owned by the UK taxpayer, have made 3.2 billion and 4.3 billion pounds respectively in liability management gains in the last three years.

Britain changed the tax treatment of how bond buybacks were dealt with two years ago and the Treasury said the schemes used by Barclays were designed to work around that legislation.

SAVING BILLIONS

Tax systems are complex and experts say companies have a duty to shareholders to minimise tax, leaving a grey area on what is acceptable. The row with Barclays shows Britain is cracking down, and also that the environment has become more unpredictable.

HSBC, Britain's biggest bank, on Monday said it was in a dispute with UK authorities over tax paid by Asian and some European subsidiaries to an HSBC holding company in the Netherlands from 2002 to 2009. HSBC said it could have to pay as much as $4.9 billion (3 billion pounds), plus interest, if it loses.

In the unrelated Barclays dispute, the Treasury aims to close loopholes on two schemes - one on bond buybacks and the other on authorised investment funds - to protect billions of pounds in future tax being lost.

We are willing to act because in these particular circumstances the behaviour is not acceptable and we are prepared to step in, Treasury official David Gauke said on Tuesday.

All the banks have signed a code of conduct, they have said that they wouldn't be engaging in aggressive, artificial tax avoidance arrangements of the sort that we have seen, that's been disclosed to the HMRC, and in those circumstances, when we were aware of what this bank was doing, it is right that we took strong action, he said on BBC Radio 4.

Barclays shares were down 1 percent at 241.4 pence by 2:40 p.m., underperforming a slightly weaker European bank index.

CEO Diamond said in November banks must accept responsibility for past mistakes and show how they can contribute to society and economic growth to improve their standing with the public.

He flagged citizenship on the front page of the bank's annual results two weeks ago, saying the bank paid 6.4 billion pounds in direct and indirect tax globally last year, including 2.9 billion pounds in Britain.

I suspect the bank in question is regretting what it has done. It's not going to do them any reputational good and they've not made any money out of it, Gauke said.

(Editing by Mark Potter)