Thousands of Minnesota empty-nesters would love to downsize into condos or townhouses, but can’t. Thousands of young apartment-­dwellers would love to build equity in condos or townhouses in neighborhoods they love, but can’t.

They can’t because for-sale attached dwellings are in extremely short supply, nowhere close to meeting demand. Why? Because Minnesota law discourages the building of new ownership housing that doesn’t conform to the detached single-family type. As a result, the vast majority of attached homes going up across the state in recent years has been rental apartments.

That’s not all bad. It’s healthy that renting has become an acceptable option for people with middle and upper incomes. But homeownership is a healthy option, too. And there’s no fair reason why attached dwellings should be excluded from the ownership market.

Legislators should fix the law and restore balance and choice to the housing market.

The root of the problem is the Minnesota Common Interest Ownership Act, one of a set of similar laws enacted across the country in the 1970s to protect condo owners from shoddy construction. The law gives a condo association 10 years to sue a developer over any alleged construction defects while also recovering legal costs. Similar lawsuits involving rental apartment buildings or detached houses do not provide for the same legal cost recovery.

Recent court cases have, moreover, encouraged condo associations to expand their litigation targets to include subcontractors and even architects. The upshot is that the law has become an invitation for law firms, property management companies and condo boards to team up to find as many defects as they can — large or small — before the 10-year limit runs out, then sue as many people as possible before splitting the settlement money. A wave of such suits since 2009 has brought condo construction to a standstill. Only 3 percent of attached homes built in Minnesota since 2009 have been ownership units, down from 54 percent during the previous decade.

A growing preference for renting explains only some of the shift. Most is due to the law’s perverse incentives. Minneapolis developer Kit Richardson, who, like most of his peers, has stopped building condos, explains: No building is perfect, and some lawsuits are justified. But many are the result of condo boards’ skimping on maintenance and then, as the 10-year limit approaches, launching lawsuits for which legal costs will be reimbursed. “They have almost nothing to lose by going to court,” he said, adding that these suits have become so routine that developers, architects and banks are no longer willing to shoulder the risk of building condos.

The legislative remedy should make problem-solving the top priority and legal action the last resort. Mediation should be promoted as a cost-effective, preferred method for resolving conflicts. A majority of condo association members (not a majority of the board) should be required to approve going forward with legal action. Attorney fees and insurance policies should be handled no differently for attached ownership units than for other housing types.

It’s possible to protect consumers without distorting the housing market and shutting off housing choices.