Beware the law of unintended consequences.

For example, in an attempt to push landlords to be more selective about their tenants, quite a few municipalities in New York passed “nuisance laws” that subject landlords to fines should one of their properties be prone to a certain number of calls to police, or to repeated conduct that’s deemed to be a nuisance.

The landlords can either pay the fine or eliminate the nuisance, which they usually do by evicting the tenant.

You can guess what these ordinances were aimed at: drug dealing, loitering, gang violence, that kind of thing.

This brings to mind a legal axiom: Hard cases make bad law.

Which is to say, legislating based on extreme cases is a bad idea.

Quick “common sense” solutions to complex problems rarely are; oversimplifying creates a whole new set of headaches.

Many of the municipal ordinances are broad - never a good thing in law - and made no exceptions to the emergency call tallies for victims of domestic violence or other assaults, or for emergency medical calls. Landlords, interested in both having fully occupied rentals and in not having to pay fines, might tend to discourage tenants from making those calls.

According to the New York Civil Liberties Union, “research on nuisance ordinances in New York State has shown that enforcement of these ordinances disproportionately impacts domestic violence survivors, crime victims, communities of color, low-income housing and people with disabilities, as tenants are forced to choose between losing their housing if they call for help when they need it or going without emergency services that could save their lives.”

Imagine that you’re having chest pains, or you’ve got a respiratory illness that has gotten a lot worse and you’re struggling to breathe. You want to call 911, but first you have to decide if you’re sick enough to risk getting evicted for it.

Imagine being choked and threatened with death by your significant other, and wondering if a call for help will leave you homeless.

After years of lobbying by the ACLU Women’s Rights Project, the Empire Justice Center, the NYCLU, the NYS Coalition Against Domestic Violence, state government (finally) did something about the issue: The Assembly and Senate passed the Right to Call 911 bill this past session, and on Monday, Gov. Andrew Cuomo signed it into law.

To be clear, under the law, domestic violence victims, and anyone who believes they are in need of police or other emergency assistance, have the right to call for help, without being penalized. Municipalities that want to enforce their nuisance regs have to provide notice to landlords and tenants, and give them the right to contest the case. The law protects the landlords against municipal penalties when tenants exercise their rights, and protects the tenants from retaliation for seeking help.

The law allows landlords and tenants to sue for damages, costs, legal fees and other relief when a municipality enforces a nuisance law against them in violation of the new law.

The law also allows a landlord to go to court to remove or evict the perpetrator of violence from a property while allowing the victim to stay.

Good law takes more than good intentions. Lawmakers should listen to the people who know the issues best.

On Twitter @HeatherYakin845