Image caption Fannie Mae has received about $116bn in taxpayer funds

US federal mortgage agency Fannie Mae has said it will pay $59.4bn (£38.5bn) in dividends to the US Treasury, after posting a record profit in the first quarter.

The $58.7bn net profit reflected a huge gain of $50.6bn from reversing an earlier writedown of tax benefits.

It compares with a profit of just $2.7bn in the same period a year ago.

Fannie Mae and rival Freddie Mac had to be bailed out by the government at the height of the financial crisis in 2008.

During the crisis, Fannie received tax benefits on the bad loans it had to absorb, and has now decided the time is right to capitalise on those.

"After evaluating the recoverability of Fannie Mae's deferred tax assets, as of March 31, 2013, the company determined that the factors in favour of releasing the allowance outweighed the factors in favour of maintaining it," it said in a statement.

'Cold feet'

With the latest dividend payment to the Treasury, Fannie will have repaid $95bn of the $116bn it has received from taxpayer funds.

Freddie Mac is also profitable again. On Wednesday, it reported a profit of $4.6bn in the first quarter and said it would pay a dividend of $7bn to the Treasury.

With that, it will have repaid about $37bn of the $71bn it had received.

Fannie and Freddie buy home loans, package them as bonds, guarantee them against default and sell them to investors.

Both the Obama administration and Congress want to eventually wind them down but it has yet to be decided how the government's role should be reduced.

Anthony Sanders, a real estate professor at George Mason University, Virginia, said Fannie and Freddie's return to profitability and the money they are able to return to the government may give the administration "cold feet" about winding them down.