U.S. District Judge Valerie Caproni said her decision was likely "a death knell" for the lawsuit and that an appeal may be appropriate, but that the plaintiffs' claims were too varied to be addressed in a single class action.

The complaint was originally filed in October 2012 by the American Civil Liberties Union, in what that group called the first U.S. lawsuit accusing an investment bank of discrimination for having packaged subprime mortgage loans into securities.

Homeowners accused Morgan Stanley of violating the federal Fair Housing Act by pushing now-defunct New Century Financial Corp into issuing shoddy mortgages, so that the Wall Street bank could make more money by packaging them into securities.

"The subprime mortgage crisis undoubtedly damaged our economy and may have - as plaintiffs contend - exacerbated preexisting racial disparities in socioeconomic status," Caproni wrote in a 50-page decision.

"While the court is not unsympathetic to plaintiffs' claims, the harmfulness of the terms that plaintiffs claim that Morgan Stanley caused New Century to include in loans and the role that Morgan Stanley played in causing the terms of specific plaintiffs' loans differ considerably," she added. "Accordingly, plaintiffs' proposed class is unworkable."

Morgan Stanley did not immediately respond to a request for comment. Lawyers for the plaintiffs did not immediately respond to a similar request.

Many other U.S. lawsuits have targeted mortgage lenders themselves for allegedly steering minority borrowers into onerous home loans, leading to more foreclosures.

The Detroit plaintiffs had sought class-action status for all blacks who lived in that area from 2004 and 2007 and received New Century loans that carried an increased risk of default.

Caproni said the variations among prospective class members "would require mini-trials as to many, maybe hundreds, of groups of borrowers," making certification of one class inappropriate.

The case is Adkins et al v. Morgan Stanley et al, U.S. District Court, Southern District of New York, No. 12-07667.

(Reporting by Jonathan Stempel and Nate Raymond in New York; Editing by Alan Crosby)

By Jonathan Stempel and Nate Raymond