UBS did not specify the size of the settlement with the Federal Housing Finance Agency, the regulator for Fannie and Freddie. But in a statement the bank said its second-quarter earnings would include a $746 million pretax charge for litigation matters related to its previous housing market activity.
The FHFA suit alleged more than $900 million in losses by Fannie and Freddie from the bad UBS bonds.
In announcing its preliminary second-quarter earnings, UBS said it had "reached an agreement in principle" with the FHFA to settle claims related to the sale from 2004 to 2007 of securites backed by home mortgages.
The agency is the conservator for Fannie and Freddie, who were seized by the U.S. government in 2008 as they teetered on the brink of bankruptcy because of bad mortgages they purchased during the housing bubble.
FHFA sued UBS in 2011, one of numerous suits the regulator has filed against banks alleging they misrepresented the quality of mortgage-backed securities sold to Fannie and Freddie.
The settlement requires final approval by both sides, UBS said. An FHFA spokeswoman could not be immediately reached for comment.
UBS had been fighting the suit, but lost an appeal in federal court in Arpil.
The FHFA settlement was part of $922 million in pretax charges UBS said it was taking against second-quarter earnings for litigation. The bank also previewed those earnings, due later this month, saying profit rose to $735 million, beating analysts' expectations.