U.S. District Judge Richard Sullivan in Manhattan issued the ruling. The case is dismissed with prejudice, meaning the plaintiffs cannot replead their case at the district court level.

"Although UBS made a series of bad bets with disastrous consequences for the company and its shareholders, those consequences alone are insufficient to establish and support a claim for securities fraud," Sullivan wrote.

Karina Byrne, a UBS spokeswoman, said the bank "is pleased with Judge Sullivan's well-reasoned decision dismissing the complaint with prejudice."

Lawyers for the plaintiffs did not immediately respond to requests for comment.

The lawsuit, filed in 2007, spilled out of UBS's subprime mortgage losses during the height of the financial crisis. UBS wrote down $48.6 billion in assets between 2007 and 2009 due to its investments in mortgage-backed securities that went sour, according to the complaint.

The lawsuit accused UBS of violating U.S. securities laws by issuing fraudulent statements related to its mortgage-related and auction rate securities portfolios.

The plaintiffs also claimed UBS misled investors by engaging in a scheme in which its Swiss bankers helped U.S. clients engage in tax evasion. UBS ultimately in 2009 agreed to a $780 million settlement with the U.S. government to settle its criminal probe.

But Sullivan said the plaintiffs had failed to put forward a case that UBS had acted with intent to defraud investors. The judge separately said the investors had failed to allege that any mistatements or omissions related to its private banking business were material.

The lead plaintiff in the case was the City of Pontiac Policemen's and Firemen's Reitrement System. An earlier decision by Sullivan had limited the class to investors who had not bought UBS shares on foreign stock exchanges.

The case is In re UBS AG Securities Litigation, U.S. District Court for the Southern District of New York, 07-cv-11225

(Reporting By Nate Raymond in New York; Editing by Gerald E. McCormick and Kenneth Barry)

By Nate Raymond