How do you stop the torrent of kids risking their lives and coming to America illegally? One key way: by finally fixing the Flores agreement, as President Trump hopes to do.

Wednesday, Trump unveiled a plan to scrap the 20-day limit on keeping migrant kids in detention. The cap, in effect since 2015 and part of the 1997 Flores consent decree, set up a Catch-22: If kids can’t be held more than 20 days, and no one wants to separate them from their parents (or other adults they come with), then the only option is to release the whole family.

That creates an enormous incentive for adult migrants to bring kids along, even if the journey puts them in danger. And it makes America’s immigration system unworkable.

Pro-immigration advocates, of course, blast the plan, calling it a cruel way to cut immigration: “This new rule is about letting President Trump . . . keep children in awful conditions for longer periods of time and continue the administration’s horrid treatment of innocent migrant families,” huffs Sen. Chuck Schumer.

Memo to Schumer: Migrant families who cross illegally and try to game the system aren’t exactly “innocent.” And clearly, there’s a problem: Almost 475,000 families crossed the border in the last 10 months, notes Homeland Security Acting Secretary Kevin McAleenan. Does Schumer want them all to simply disappear throughout the country, with no vetting or processing or waiting their turn?

The rule can be implemented humanely: It spells out standards for detention centers, including health care, education and food. Congress can improve on them, if it likes, and provide funding. And by the way, past presidents, including President Barack Obama, sought similar fixes.

Democrats like Schumer would prefer no detentions at all — just let migrants come right in. But Trump is offering a humane way to, as McAleenan put it, enforce laws Congress passed. And ensure some order to the immigration process.