Goldman Sachs Group Inc was sued by Liberty Mutual Insurance Co, which accused the Wall Street bank of fraudulently misleading it into buying preferred stock of mortgage financier Fannie Mae that would become virtually worthless.

In a lawsuit filed Thursday in Boston federal court, Liberty Mutual said it deserves to be reimbursed for losses on the $62.5 million of Fannie Mae preferred stock it had bought in late 2007 through offerings underwritten by Goldman.

Liberty Mutual, one of the nation's largest insurers, said Goldman knew of significant problems in subprime and other risky mortgages in late 2006 and throughout 2007, and generated large profits for itself by betting against the market.

It also said Goldman falsely stated that the purpose of the offerings was to let Fannie Mae raise excess capital, when in fact Fannie Mae was severely undercapitalized and needed to raise money to stay in business.

As a knowledgeable and sophisticated investor in the U.S. real estate financial markets, and with access to Fannie Mae's financial records, Goldman Sachs knew or recklessly disregarded the actual status of Fannie Mae's capital structure, Boston-based Liberty Mutual said. As a result of plaintiffs' reliance on Goldman Sachs' material misrepresentations, plaintiffs' investments are virtually worthless.

The U.S. Treasury Department in September 2008 effectively nationalized Fannie Mae and Freddie Mac , which together owned or guaranteed nearly half of all U.S. mortgages, by putting them into a conservatorship.

Preferred stock investors, including many large banks, suffered losses because the bailout ended dividend payouts and included the issuance to the government of new preferred shares that were senior to the existing preferred stock.

We think the suit is entirely without merit and we will contest it vigorously, a Goldman spokesman said in an e-mail.

On April 16, the U.S. Securities and Exchange Commission filed a civil fraud lawsuit accusing Goldman of creating and marketing collateralized debt obligations linked to subprime mortgages in early 2007, without telling investors that hedge fund Paulson & Co helped choose and was betting against them.

Goldman has denied wrongdoing. At least 18 shareholder lawsuits have been filed against Goldman and its officials arising out of that arrangement, known as Abacus.

In afternoon trading, Goldman shares were up $2.65, or 2 percent, at $138.11 on the New York Stock Exchange. Fannie Mae shares rose about 6.5 cents to 25.5 cents in their second day of OTC Bulletin Board trading, after moving from the Big Board.

The latest case is Liberty Mutual Insurance Co et al v. Goldman Sachs & Co, U.S. District Court, District of Massachusetts, No. 10-11150.

(Reporting by Jonathan Stempel; Additional reporting by Steve Eder and Al Yoon; Editing by Gerald E. McCormick)