WASHINGTON — Home prices are up. Foreclosures are down. Construction is up. And now comes the latest sign of the US home market’s revival: Fannie Mae, the mortgage giant that nearly collapsed five years ago, has earned its biggest yearly profit to date.
Fannie Mae earned $17.2 billion last year and said Tuesday that it expects to stay profitable for ‘‘the foreseeable future.’’ It also paid $11.6 billion in dividends to the Treasury in 2012.
And last year was Fannie’s first since its takeover by the government in 2008 that it asked for no federal aid. As recently as 2011, Fannie lost nearly $17 billion and requested and received nearly $26 billion in aid.
The speed of Fannie’s resurgence is a testament to a much healthier US mortgage market.
Fannie’s ‘‘profit recovery has come at a faster pace than I thought it would,’’ said Bert Ely, a banking industry consultant.
Once symbols of the reckless risk-taking that fed the housing bubble, Fannie and the smaller firm Freddie Mac were seized by the government in 2008 after they were buried by bad mortgages. Taxpayers have spent $188 billion to rescue the two — collectively the costliest bailout of the financial crisis.
During much of the 1980s and 1990s, Fannie Mae’s stock was a darling of Wall Street, thanks in part to home-price increases and the government’s implicit backing. In 1988, it was added to the Standard & Poor’s 500 stock index. By 1996, Fannie had reported its 10th straight year of record profits.
Pay for Fannie’s top executive soared. One former chief executive, Franklin Raines, received roughly $90 million in compensation from 1998 through 2003, according to Fannie’s regulator. The regulator concluded that some Fannie employees had rigged accounting so the company could meet earnings targets and top executives could receive bonuses.
The excesses at Fannie paralleled the housing market’s surge — until they fizzled along with the housing boom.
Fannie still has a long way to go to repay taxpayers. It received $116 billion in aid. So far, it has repaid $35.6 billion.
Fannie and Freddie don’t actually make loans. Rather, they buy mortgages from lenders, package them as bonds, guarantee them against default, and sell them to investors. In doing so, they help make loans available and exert influence over the housing market.
Together, Fannie and Freddie own or guarantee about half of US mortgages — nearly 31 million home loans worth $5 trillion. And along with other federal agencies, they back about 90 percent of new mortgages.
The two companies nearly folded during the financial crisis because of huge losses on risky mortgages they bought. Now, they are benefiting from the home market’s steady recovery.
Nationally, prices have risen nearly 9 percent since bottoming in March 2012.