Housing shortages are plunging New York City and Los Angeles into crisis. Affordable rental units are scarce, families are doubling up, shelters are jam-packed and tens of thousands are sleeping sprawled on the streets of these two cities.

The wait-list for public housing is more than four years long in LA and would be even longer if officials hadn’t closed it to new applicants. Here in New York, the wait is a staggering 10 years.

Nationwide, illegal immigrants take up some 32,000 public apartments. It’s a powerful reason why the Trump administration is giving them 18 months to get out of taxpayer-subsidized public housing.

“There is an affordable-housing crisis in this country, and we need to make certain our scarce public ­resources help those who are ­legally entitled to it,” explains Housing and Urban Development Secretary Ben Carson.

Mayor Bill de Blasio is slamming the proposal, saying, “This is what cruelty looks like.” Hizzoner couldn’t be more wrong. Playing political games with people’s lives is what’s cruel.

Only one out of every four Americans who qualifies for public housing is able to get it, Carson says. “Fairness requires that we devote ourselves to legal residents who have been waiting, some for many years.”

But the Democrats would rather pander to the pro-immigrant vote than look out for their own constituents. Democrats representing New York in Congress signed a letter opposing HUD’s action to free up housing units for legal residents. Rep. Nydia Velazquez calls the policy “sickeningly cruel.” These lawmakers are double-crossing taxpayers and law-abiding families in their own districts who are struggling to make it.

Across urban America, millennials are putting off starting families because housing costs too much. It’s a major reason the birthrate is dropping. But for illegal immigrants, having a baby here is their E-Z pass into taxpayer-funded public housing.

That’s because 20 years ago, President Bill Clinton issued an informal “field” recommendation to loosen eligibility for welfare benefits without getting Congress’ ­approval. Clinton dubbed illegal immigrants who have a baby born in the US “mixed-immigration-status families” and made them eligible for public housing. As if the baby’s the one signing the lease. The Trump administration is putting an end to this farce.

Dems are protesting that evicting illegal immigrants will mean separating parents from their American-born children. The theatrics are embarrassing. When they vacate public housing, they’ll take their children with them.

On Tuesday, at a House hearing, Rep. Carolyn Maloney of New York dragged the political discussion to a new low, calling Carson “despicable” for “ripping apart families and throwing children on the street.” Carson calmly reminded Maloney that there are hundreds of thousands of children in need of decent housing whose parents are here ­legally. “Do you suggest that we prioritize” families breaking the law instead, he asked?

Carson exposed the hypocrisy of New York Democrats’ bleeding-heart rhetoric about public housing. The de Blasio administration, he said, allowed conditions in public housing to deteriorate so badly that 83% of units pose health threats, with toxic lead paint, mold, broken elevators and no heat in winter. This January, HUD sent in a federal monitor to take over.

In many cities, Democratic politicians grandstand that they welcome illegal immigrants with open arms. These pols’ magnanimity is at the expense of the very people who elect them, taxpayers and American families who depend on public schools, housing and other services. Place one newly arrived migrant child who speaks no English and has no school experience in a classroom, and the bulk of a teacher’s focus has to be on that one child. The other kids lose out.

So do federal taxpayers. Once migrants make it across the southern border and settle, they have more children, and their US-born children collect welfare, food stamps and other benefits.

As a million illegal immigrants flood across the southern border this year, open-borders Democrats need to be honest about the impact on affordable housing and quality of life. Sadly, Tuesday’s hearing tells us not to count on it.

Betsy McCaughey is a former lieutenant governor of New York.