Westpac has lost its legal battle with New Zealand's Inland Revenue Department (IRD) over tax avoidance, the department announced today. The Australian giant now owes the NZ government $NZ961m ($796m) in tax and interest and could be hit with up to $NZ35m ($29m) in penalties.

The bank put its shares into a trading halt yesterday afternoon and has flagged the possibility of further expensive legal action.

The court upheld the IRD's claim that Westpac attempted to avoid paying tax in New Zealand by setting up "sham" loans between 1998 and 2002.

In fact, all of Australia's big four have engaged in the practice of making loans that were, in effect, sale and repurchase agreements. The banks would agree to lend money to a company, then buy a stake in that company equal to the value of the loan and require the company to repurchase the stake later at a certain price.

Of the major banks, Westpac had the highest exposure to these loan structures, with the NZ subsidiaries of CBA, NAB and ANZ each now facing slugs of between $NZ280m ($231m) and $NZ524m ($433m).