The House Financial Services Committee approved legislation Tuesday that would suspend tens of millions in Fannie and Freddie executive compensation packages, stop future bonuses and align their salaries with other federal employees who make much less. The vote was 52-4, with strong support from both parties.

The Senate is expected to take up a similar measure. Lawmakers say the legislation limiting pay at the bailed-out firms could be sent to President Barack Obama by the end of this year.

Twelve executives at the firms received roughly $35.4 million in total salary and bonuses in 2009 and 2010. Fannie CEO Michael J. Williams received about $9.3 million for the two years. Freddie CEO Edward Haldeman Jr. was paid $7.8 million for that stretch.

The government rescued Washington-based Fannie and McLean, Va.-based Freddie three years ago after they nearly folded because of big losses on risky mortgages they purchased. Taxpayers have spent about $170 billion to rescue the two firms, the most expensive bailout of the 2008 financial crisis.

The government estimates the bailout could reach up to $220 billion through 2014.

"These lavish compensation packages and bonuses are unfair, unreasonable and unjust to the taxpayers whose assistance is the only thing keeping Fannie and Freddie afloat," said Rep. Spencer Bachus (R-Ala.), chairman of the House committee.

Edward DeMarco, acting director of the Federal Housing Finance Agency, said the executives were hired after the companies were taken over by the government in 2008. After the takeover, the salaries for those positions were reduced by an average of 40 percent and some senior positions were eliminated, he said.

DeMarco told the Senate Banking Committee that bonuses are being used to keep talented executives with the companies. Without them, taxpayers would incur greater losses.

"The people who are there now did not choose government jobs," he said. "A sudden and sharp change in pay would certainly risk a substantial exodus of talent, the best leaving first in many instances."

Fannie and Freddie own or guarantee about half of all mortgages in the U.S., or nearly 31 million home loans. Along with other federal agencies, they backed nearly 90 percent of new mortgages over the past year.