A U.S. federal judge ruled that Morgan Stanley and two credit rating agencies must defend fraud charges in a class-action lawsuit accusing them of masking the risks of an investment linked to subprime mortgages, and which eventually collapsed.

U.S. District Judge Shira Scheindlin on Wednesday rejected efforts by Morgan Stanley, Moody's Corp's Moody's Investors Service and McGraw-Hill Cos' Standard & Poor's to dismiss fraud claims brought by the plaintiffs, Abu Dhabi Commercial Bank and King County in Washington state.

She dismissed the plaintiffs' remaining claims, and all claims against a fourth defendant, Bank of New York Mellon Corp , while granting permission for the plaintiffs to amend their complaint.

Scheindlin's ruling could affect other lawsuits brought by pension funds and other investors, seeking to hold banks and credit raters responsible for hyping the value of complex debt to win fees and causing investor losses as the debt collapsed.

The case concerned the Cheyne Structured Investment Vehicle (SIV), which went bankrupt in August 2007 after the quality of its assets plummeted. Many investors in Cheyne-related notes lost much or all of their investments.

SIVs are complex packages of loans and debt, including collateralized debt obligations, that once held some $350 billion of assets before falling out of favor.

The California Public Employees' Retirement System, the nation's largest public pension fund, in July sued Moody's, S&P and Fitch Ratings over losses on Cheyne and other SIVs.

In the New York case, the plaintiffs alleged that Morgan Stanley wrongly marketed Cheyne as a high-quality investment, and that the rating agencies assigned improperly high ratings.

The complaint also accused Bank of New York Mellon, acting as a depositary and processing agent, of improperly valuing Cheyne's assets and delivering reports to the rating agencies.

In a 68-page ruling, Scheindlin said the plaintiffs pleaded enough facts to let the fraud claims case go forward.

Where both the rating agencies and Morgan Stanley knew that the ratings process was flawed, knew that the portfolio was not a safe, stable investment, and knew that the rating agencies could not issue an objective rating because of the effect it would have on their compensation, it may be plausibly inferred that Morgan Stanley and the rating agencies knew they were disseminating false and misleading ratings, she wrote.

Scheindlin set an October 1 status conference in the case.

McGraw-Hill spokesman Frank Briamonte said the company was pleased that Scheindlin dismissed all but one of 11 claims it faced, and said it was confident it would prevail on the remaining claim.

Bank of New York Mellon spokesman Kevin Heine had no immediate comment. The rest of the parties did not immediately return calls or e-mails seeking comment.

The case is Abu Dhabi Commercial Bank v. Morgan Stanley, U.S. District Court, Southern District of New York (Manhattan), No. 08-7508.

(Reporting by Jonathan Stempel, editing by Leslie Gevirtz, Bernard Orr)