Goldman Sachs Group Inc issued a spirited defense in its annual shareholder letter against allegations that it had benefited unduly from government help and bet against its own clients during the financial crisis.

The dominant Wall Street firm said it did not intentionally bet against securities in the mortgage market during the financial crisis, dismissing suggestions that it unfairly made money by placing bets against its clients.

In the letter introducing its annual report, Goldman also defended its relationship with the bailed-out U.S. insurer American International Group Inc . Goldman was one of AIG's largest trading counterparties and received full payment on credit default swaps on which the insurer was a counterparty thanks to the government rescue.

The letter, signed by CEO Lloyd Blankfein and Gary Cohn, president and chief operating officer, also addressed criticism about overly generous pay. It marks Goldman's most thorough effort yet to rebut a rising chorus of criticism over the past year as the bank enjoyed a year of record profits after benefiting from various government programs and policies.

As a market maker, we execute a variety of transactions with clients and other market participants... which may result in long or short risk exposures to thousands of different instruments at any given time, said the letter .

Goldman said it did not generate enormous net revenue or profit by betting against residential mortgage-related products.

However, following its decision to reduce its exposure to risky mortgage securities, the bank said it lost less money than it otherwise would have when the residential housing market began to deteriorate rapidly.

In January, Blankfein faced harsh questioning from the chairman of the Financial Crisis Inquiry Commission, who accused Goldman of knowingly creating shoddy subprime-backed securities for customers, and then betting they would default.

AIG

Goldman said it bought protection on super-senior collateralized debt obligation (CDO) risk from AIG only as part of a trading relationship.

This protection was designed to hedge equivalent transactions executed with clients taking the other side of the same trades. In so doing, we served as an intermediary in assisting our clients to express a defined view on the market, Goldman said.

Many banks, including Goldman, were among the recipients of tens of billions of federal bailout dollars that were funneled through the insurer at the height of the crisis, saving them from potential losses and causing a public uproar.

The bank said its total exposure on the securities on which it bought protection was roughly $10 billion and it held about $7.5 billion in collateral from AIG. The remainder was covered through other hedges entered with various counterparties.

If AIG had failed, we would have had the collateral from AIG and the proceeds from the Credit Default Swap (CDS) protection we purchased.

Therefore, we would not have incurred any material economic loss, Goldman said.

Goldman did acknowledge that it and every other financial institution and company, benefited from the continued viability of AIG, saying its failure would have been extremely disruptive to the world's already turbulent financial markets.

PAY-FOR-PERFORMANCE

The Goldman executives also addressed the widespread attention the firm has gotten for its pay practices since the financial crisis. Goldman last year was on pace to pay out record compensation in 2009, topping $20 billion, but changed course at the end of the year, instead paying $16.2 billion.

The move came after a public uproar about how Wall Street firms were setting aside billions of dollars to pay their employees soon after U.S. taxpayers committed hundreds of billions of dollars to rescue the banking industry.

We have not been blind to the attention on our industry and, in particular, on Goldman Sachs, with respect to compensation, the executives wrote, adding Our approach to compensation reflected the extraordinary events of 2009.

Blankfein and other top Goldman executives received all-stock bonuses worth $8.9 billion for 2009.

(Reporting by Sakthi Prasad in Bangalore and Steve Eder in New York; Editing by Jon Loades-Carter, Dave Zimmerman.)