For Twin Cities home sellers, 2017 was the best year in memory. For buyers, it was one of the worst.

With listings falling to a 15-year low and closings rising to a 12-year high, sellers were in the driver's seat and median prices hit an all-time high, year-end data from the Minneapolis Association of Realtors showed Tuesday.

"The market was strong, stable and positive," said Jeremy Peterson, a ReMax Results agent.

Throughout the year there were a total of 76,159 listings — 2.2 percent fewer than the year before, while buyers closed on 61,168 properties, just 12 short of an all-time high, the association said.

On average, houses sold in 56 days, which was an 11-year low. The median price of all closings rose 7 percent to $246,000, which was an all-time high.

The market in the Twin Cities was buoyed by a combination of demographic and economic factors led by mortgage rates that remained much lower than expected. Long-term mortgage rates remained below 4 percent for most of the year, contrary to predictions that they would match the Federal Reserve's increases to banks' key borrowing rates.

A strong, diverse economy and rising rents also helped bolster demand, especially among young people who came to realize that in some cases buying a house can be less expensive than renting.

Those former renters and other first-time buyers had limited options however, given that rising construction costs made it difficult for builders to satisfy that market. Though homebuilders in the Twin Cities issued more permits than they had in decades, most of them were for market-rate rentals in the suburbs and upper-bracket single-family houses.

The shortage of starter homes — mostly those at less than $250,000, was so intense, many would-be buyers were stuck on the sidelines, stifling sales in a market where buyers were forced to make quick decisions and strong offers.

"It was an interesting year in a lot of ways," said Kath Hammerseng, MAAR president and a sales agent with Edina Realty. "In addition to record prices and near-record sales, the inventory shortage and some affordability concerns also took center stage."

The Shenehon Center at the University of St. Thomas said with baby boomers getting older and retiring, millennials have become the largest buying group and the dominant force in the market. Last year, about half of all buyers were 35 and younger.

With those younger buyers in the market, owners of starter houses are cashing out and sales of move-up houses are increasing. By the end of the year, there was a 48 percent decline in listings of homes priced from $150,000 to $190,000 and a corresponding 10 percent decline in the number of pending sales in that price range. For houses priced at $1 million and more, there was a 22 percent decline in listings and a 31 percent increase in sales.

Many buyers competed by offering sellers more than their asking price. On average, sellers received 99.4 percent of their asking price, an all-time high. For entry-level buyers, the situation was made more desperate by a continuing decline in the number of foreclosures and short sales. While there was a 3.7 percent increase in "traditional" sales, foreclosure sales fell 43 percent and short sales were down by half.

Peterson, the real estate agent, said he closed just short of 300 homes in 2016. But in 2017, with far fewer distressed sales and a shortage of entry-level listings, he closed just under 250 sales.

Sellers clearly had the strongest hand over entry-level buyers in Minneapolis, St. Paul and the inner-ring suburbs.

Michael Lassonde spent the latter half of the year shopping for an entry-level house and resorted to an extreme move in December. After his agent spotted a fixer-upper in Apple Valley that had fallen $10,000 in price, Lassonde made an offer sight unseen. By the next morning, the seller accepted.

"I thought there was going to be a bidding war," Lassonde said. "It was time to jump on it. We just had to do it."

Jim Buchta • 612-673-7376