MIAMI – Officially, there are 3.5 million homes for sale nationwide. But there are millions more lurking in the shadows — hidden neatly away on banks’ balance sheets, stalled in foreclosure court proceedings or simply occupied by nonpaying owners as lenders wait months or years before taking action.

The housing market’s ballooning shadow inventory — buoyed by a yearlong foreclosure slowdown — stands as the most menacing obstacle to the recovery of the residential real estate market.

Clustered mostly in hard-hit cities and states, there are more than 4.5 million homes either owned by lenders or headed for foreclosure. In Miami, for example, there are about 200,000 shadow homes, dwarfing the 30,000 properties that are listed on the active market. Even as prices in Miami have shown signs of stability this year, an impending wave of foreclosures threatens to keep real estate values deflated.

“A lot of people don’t understand how much inventory is set to come on line in the next 18 to 24 months,” said Jack McCabe, the CEO of McCabe Research & Consulting in Deerfield Beach, Fla. “When you compare what the Realtors show as inventory to what’s out there, you realize we have a long way to go.”

A McClatchy Newspapers analysis of four years of foreclosure data and thousands of property records found record-high levels of shadow inventory in several housing markets across the nation.

Though real estate trade groups routinely leave these shadow properties out of monthly reports, their influence on home values has grown sharply in recent years.

In the supply-and-demand-reliant real estate market, the national supply of homes is officially listed at about 3.5 million, or about nine months’ worth; sales are on track to reach about 5 million this year. But once shadow inventory is added, that supply more than doubles, to at least 7.5 million. A healthy housing market has about a six-month supply of properties, which would be about 2.4 million.

The wave of homes yet to hit the market consists of discounted distressed properties. Economists say the housing industry will not normalize and recover until most of the foreclosures work their way through the system — a process that probably will last several more years.