Housing dominated the construction industry in the Twin Cities this year, with demand for new apartments and single-family houses propelling homebuilders to their busiest year in at least 15 years.

During 2019, homebuilders were issued 6,446 permits to build 15,467 units — a 21% gain in total units over the previous year, according to a year-end report from Housing First Minnesota, a trade group that represents homebuilders in the state.

The vast majority of those housing units were market-rate rentals, which posted a 36% increase over last year and accounted for 60% of all residential construction.

Despite those gains, builders struggled to manage rising costs for everything from land to labor, and a late-in-the-year increase in single-family construction helped that segment of the industry outperform the previous year, but by a much narrower single-digit margin.

“We’re pleased to see 2019 homebuilding activity end the year up after such a slow start,” John Rask, a homebuilder and president of Housing First Minnesota, said in a statement. “The market demand is definitely there for new housing, yet the housing industry is facing multiple headwinds.”

That annual gain came after an unusually slow December for both apartment and single-family homebuilding, which declined 14% from last year.

Multifamily construction during December declined 18% compared with last year, but 2019 was still a record year for apartment developers and builders.

By several measures, the Twin Cities has been one of the strongest markets in the nation for rentals. The most recent report from Yardi-Matrix said that by the end of October the vacancy rate in the Twin Cities metro was the lowest in the nation, with annual rent raises among the top 10 highest across the country.

And on Thursday, Dodge Data & Analytics said that by the end of November there had been more than $4.1 billion in residential construction throughout the 13-county metro, an increase of 6% over last year and $1.1 billion more than the commercial sector, which saw a double-digit annual decline.

David Siegel, executive director of Housing First Minnesota, said that although the industry is making significant gains, the market remains unbalanced and is unlikely to improve in the new year.

“While it is great to see growth in residential construction,” he said, “the permit numbers and units we saw in 2019 are still thousands of units short of what our region needs in order to make a dent in our housing crisis and lack of inventory.”