A dearth of house listings and the lowest mortgage rates in a generation were supposed to make 2018 the best year since the recession for Twin Cities homebuilders.

It didn't happen.

Builders paid more for land, labor and materials, making it difficult for them to cater to a segment of the market where demand was most fierce: first-time buyers and downsizing baby boomers.

That disconnect between supply and demand helped make 2018 a less-than-stellar year for housing construction. Throughout the metro 12,749 housing units were permitted, according to a year-end report from Housing First Minnesota, a trade group that represents homebuilders. That included 5,880 for-sale, single-family houses, only 34 more than were permitted the previous year.

"Despite slower growth than expected in 2018, it was a very strong year for new home construction," said Tom Wiener, 2018 president Housing First Minnesota.

With the rental market approaching saturation in some parts of the Twin Cities, apartment construction slowed dramatically. During the year developers pulled permits to build 6,869 rental apartments and other multifamily units, 9 percent less than 2017.

Multifamily construction represented 53 percent of all housing units permitted during the year in the Twin Cities metro.

The year-end totals received a boost during an unusually busy December when single-family construction saw a 36 percent increase in the number of permits pulled over December 2017. Multifamily construction, which is volatile from month to month, increased 33 percent during December.

With budget-conscious first-time buyers and downsizing baby boomers driving home sales last year, many builders focused on for-sale townhouses, which tend to be smaller and take up less land than a typical single-family house, and thus are more affordable.

"There's high demand for new housing in the Twin Cities and builders are innovating to meet home buyers' needs and budgets," Wiener said.

During the year there was a 28 percent increase in attached, for-sale houses compared with the previous year. That doesn't include detached, villa-style houses in association-maintained communities.

The median sale price of a new house in the Twin Cities was about $420,000 last fall, nearly $200,000 more than the median price of a pre-owned house, according to the Minneapolis Area Realtors.

At the same time, new townhouses sold for about $100,000 less than those new single-family houses, even though the price per square foot was about the same.

Danielle Leach, Midwest regional director for Metrostudy, which tracks housing construction lot-by-lot across the metro, said that while homebuilders in the Twin Cities might have hoped for a better year, the region outperformed most similar-sized metropolitan areas. That's based on a 9.6 percent annual increase in construction starts during the third quarter.

She said that to make houses less expensive and meet deep demand for urban and close-in suburban locales, many builders and developers are trying to focus on inner-ring subdivisions with smaller lots than the typical suburban subdivisions that were popular before the housing crash.

"Buyers want to be closer, but can't afford it, so they're willing to make product choices," she said. "So it's either an attached house or it's a smaller lot."

Third-quarter data from Metrostudy, which tracks housing starts and completions rather than permit issuance, reveals a troubling trend for the industry: The supply of houses priced at less than $350,000 is dwindling quickly, and that means even more challenging times ahead for builders and buyers.

"Affordability is a huge issue for a lot of people," said Wiener, who said many potential buyers can't afford $400,000 for a new home. "But it's getting to the point where I can't touch anything at that point."