By Andrew Ackerman

WASHINGTON -- Mortgage giants Fannie Mae and Freddie Mac said they had hired major Wall Street firms to advise them on raising fresh capital as they move to exit government control.

On Monday Fannie said it had tapped Morgan Stanley, and Freddie said it had hired JPMorgan Chase & Co. The moves are the latest in the yearslong effort to return the mortgage companies to private ownership after they were bailed out by the government during the financial crisis.

The firms' independent federal regulator, the Federal Housing Finance Agency, hired its own adviser, the investment bank Houlihan Lokey, in February. Fannie and Freddie back about half of the $11 trillion U.S. mortgage market and are central to the widespread availability of the popular 30-year, fixed-rate mortgage.

The banks' advisory roles won't preclude them from potentially lucrative contracts to help underwrite any new public offerings of shares, according to people familiar with the matter.

Officials have talked about public offerings of shares in 2021 or 2022, but have set no hard deadline. FHFA director Mark Calabria told Senate lawmakers last week that the process of allowing the companies to exit government control has been delayed three or four months by the fallout from the coronavirus pandemic.

He said there could be further delays if a significant portion of the millions of homeowners who were allowed to pause their mortgage payments due to the pandemic are unable to get current on their loans.

"There are a tremendous amount of unknowns here," Mr. Calabria said.

Shoring up the firms' finances could require the companies to hold some $240 billion of capital, in part by selling new shares in public offerings, FHFA said last month. Fannie and Freddie currently hold about $23.5 billion of capital between them.

Fannie and Freddie don't make loans, but purchase them from lenders. They package them into securities that are sold to investors and provide guarantees to make the investors whole if the loan defaults.

The firms ran into trouble before the 2007-08 financial crisis by taking on more risk without having to hold more capital. They amassed huge investment portfolios to profit from the difference between their low cost of capital -- a benefit of an implied federal guarantee -- and the rates they earned on mortgages.

The government seized the companies through a process known as conservatorship in 2008, during the George W. Bush administration, and injected $190 billion over a period of years.

Write to Andrew Ackerman at andrew.ackerman@wsj.com