Top executives at Fannie Mae and Freddie Mac on Wednesday defended their companies' pay practices which have drawn opposition after it was disclosed the government-controlled firms were paying out nearly $13 million in executive bonuses.

Michael Williams, chief executive of Fannie Mae, and Charles Haldeman, Freddie Mac's chief executive, both argued the compensation structures at the mortgage finance firms were warranted to retain and attract qualified staff.

A bill to block the pay packages was approved by the House Financial Services Committee on Tuesday in a 52-4 vote. The full House must still vote on the measure. A similar bill has been introduced in the Senate.

The two loss-making firms have been propped up by about $169 billion in federal aid since they were rescued by the government in 2008.

In testimony before a U.S. House of Representatives committee, the firms' executives said cutting compensation for workers at Fannie Mae and Freddie Mac would be disruptive and limit their ability to attract skilled management.

We need to compensate our executives and employees to ensure that we have and keep the leadership we need to continue our progress, Williams told the House Oversight Committee.

Republicans and Democrats in both the House and Senate have expressed chagrin that the two companies were paying out $12.79 million in bonuses for 10 executives.

The government took control of the firms, the two largest sources of funding for U.S. mortgages, as mounting losses threatened their solvency during the financial crisis.

Williams said that without legislative direction from Congress on the future of the two government-sponsored enterprises, it was difficult to attract and retain employees with highly specialized skills, expertise and experience.

Democrats and Republicans largely agree the firms will eventually have to be shuttered, but lawmakers are moving cautiously given the central role the companies play in the U.S. housing finance system and the battered state of the housing sector.

The chief executives and the companies' regulator, the Federal Housing Finance Agency, made the case that uncertainty over the firms' future has made it more difficult to keep qualified personnel in place.

FHFA acting Director Edward DeMarco said the turnover rate at Freddie Mac has averaged about 13 percent in the past two quarters, well above its five-year average of about 8 percent. Fannie Mae's turnover rate sits at about an 11 percent annual rate after averaging about six percent rate over the previous three years.

A sudden and sharp change in pay would certainly risk a substantial exodus of talent, the best leaving first in many instances, he told lawmakers as he defended the compensation packages for a second straight day. DeMarco had testified on Tuesday before the Senate Banking Committee.

Haldeman, who has already said he will leave Freddie Mac once his replacement is found, said the company has reduced compensation for the top 10 percent of the management team by about 40 percent since the firm was taken over by the government in September 2008.

We have taken several measures to reduce overall compensation levels, Haldeman said. He added that it would be counterproductive to change the pay scales for the mortgage firm's employees without reform of the overall housing finance system.

It would make it much harder for us to retain people we have and attract qualified people to replace them, he said.

DeMarco, who signed off on the pay plans, said he intends to draw down the bonus levels going forward. But he defended the salaries and said Congress should implement a plan to revamp the housing finance system in order to finally resolve questions over bonus structures at the two firms.

(Reporting by Margaret Chadbourn; Editing by Kenneth Barry and Andrew Hay)