Fannie Mae, the largest provider of mortgage money in the United States, on Tuesday appointed its general counsel, Timothy Mayopoulos, as chief executive.

Washington-based Fannie Mae said Mayopoulos, 53, will become president and CEO on June 18. He replaces Michael J. Williams, who announced in January that he would step down after a successor was found.

The government rescued Fannie and smaller sibling Freddie Mac in September 2008 after the two companies absorbed huge losses on risky mortgages that threatened to topple them. Since then, a federal regulator has controlled the two companies' financial decisions.

So far, Fannie and Freddie have cost taxpayers about $170 billion — the largest bailout of the financial crisis. It could cost roughly $260 billion more to support the companies through 2014, after subtracting dividend payments, according to the government.

The companies, which own or back about 60 percent of all U.S. home loans, buy mortgages from lenders and repackage them as securities for investors with a guarantee.

In his executive roles, Mayopoulos has managed Fannie's human resources policies, communications and marketing, and government relations.