Mortgage giant Fannie Mae has agreed to pay a $400 million fine to settle charges relating to a $10.8 billion accounting scandal that allowed top executives to collect millions of dollars in bonuses. It also agrees to cap its mortgage portfolio at $727 billion.

Fannie Mae reached the agreement with the Securities and Exchange Commission and the Office of Federal Housing Enterprise Oversight, which regulates Fannie Mae, and issued a blistering report on May 23 about the $11 billion scandal.

“The image of Fannie Mae as one of the lowest-risk and ‘best in class' institutions was a facade,” James Lockhart, the acting OFHEO director, says in a statement.

“Our examination found an environment where the ends justified the means. Senior management manipulated accounting, reaped maximum, undeserved bonuses, and prevented the rest of the world from knowing,” he adds.

The report says employees at Fannie Mae manipulated accounting so that executives could collect big bonuses. The report faults Fannie Mae's board of directors for failing to uncover “a wide variety of unsafe and unsound practices.”

Capping the mortgage portfolio is a huge concession for Fannie Mae, the largest buyer and guarantor of home mortgages in the country. It has long argued that restricting growth might ultimately hurt the housing market.

“The penalty and settlements represent a major step in correcting a dangerous course that had been followed by one of the largest financial institutions in the world,” Lockhart says. “Unprincipled corporate behavior and inadequate controls will simply not be tolerated.”