Nearly four of every 10 homes sold in metro Denver in the past year sold at a loss compared with the amount owed on them.

And nearly a third of the area homes purchased since 2003 are worth less than what is owed on the mortgages, according to Zillow.com, an Internet provider of home valuations.

Foreclosures are a key reason why. About 22 percent of homes sold in the metro area were in foreclosure, Zillow reports.

Denver tracks with the national averages, which show almost one-third of U.S. homeowners who bought in the last five years owe more on their mortgages than their properties are worth.

Second-quarter home prices nationally fell 9.9 percent from a year earlier, giving 29 percent of owners negative equity, said Zillow, the Seattle- based service that offers values on more than 80 million homes. For those who bought at the 2006 peak of the housing market, 45 percent are now underwater, Zillow said.

Negative equity and declining prices contribute to the foreclosure rate because some homeowners don’t have the cash to pay off the mortgage and end up surrendering their homes to the bank that holds the loan, said Stan Humphries, Zillow’s vice president of data and analytics.

“For homeowners who need to sell, this is a gravely serious situation,” Humphries said. “It can also be harmful to communities where the number of unsold homes adds more to inventory and puts downward pressure on prices.”

Almost one-quarter of U.S. homes sold in the past year were for a loss, Zillow said.

The highest percentages of homeowners with negative equity were in California.

Prices fell on a year-over- year basis in 140 of 165 markets, Zillow said. Pittsburgh, Oklahoma City and Austin, Texas, were among the markets that saw rising home values, the company said. The 9.9 percent decline in home values was the largest on a year-over-year basis in at least 12 years, Zillow said.

The median home price of $206,919 was the lowest since the fourth quarter of 2004, the company said.

“Sellers are starting to adjust their expectations,” Zillow chief financial officer Spencer Rascoff said in a Bloomberg TV interview. “More sellers accepting a loss is actually a sign of optimism. It means that the transactions might start happening. There are so many sales contingent upon the buyer selling their home.”

The Zillow Home Value Index is calculated using a weighted average of the median home value for each county, Zillow said.

Denver Post staff writer Aldo Svaldi contributed to this report.