Citigroup said Monday it had agreed to pay $7 billion to settle a federal investigation into subprime mortgages it sold in the run-up to the financial meltdown of 2008.

The deal covers mortgage-backed securities and collateralized debt obligations issued, structured or underwritten by Citi between 2003 and 2008, the company said in a statement on its website.

Citi said it would pay $4.5 billion in cash and $2.5 billion in consumer relief, which will be in the form of financing for affordable rental housing, principal reduction for home loans and other programs by the end of 2018.

Reuters reports that the $7 billion figure was more than twice what many analysts had expected, but less than the $12 billion sought by the government.

The settlement frees Citi from potential liability for collateralized debt obligations (CDOs) as well as mortgage securities.

"The comprehensive settlement announced today with the U.S. Department of Justice, state attorneys general and the [Federal Deposit Insurance Corp.] resolves all pending civil investigations related to our legacy RMBS and CDO underwriting, structuring and issuance activities," Citigroup CEO Michael Corbat said in the statement. "We also have now resolved substantially all of our legacy RMBS and CDO litigation."

The company said it would take a charge of about $3.8 billion pre-tax in the second quarter of 2014 in connection with the settlement.

The Associated Press notes:

"The agreement announced Monday comes weeks after talks between the two sides broke down, prompting the Justice Department to warn that it would sue one of the nation's biggest banks. ..."Citigroup, among other banks, downplayed the risks of subprime mortgages when packaging them, selling them to mutual funds, investment trusts, pensions, as well as other banks and investors."

Copyright 2016 NPR. To see more, visit