The Democrats’ Hail Mary attempt to legalize millions of immigrants with no current path to citizenship or permanent legal status ended the way most such plays do: in failure. The maneuver would have made immigration reform subject to passage by a simple majority in the Democrat-controlled Senate, rather than by the usual 60 votes required, by attaching it to an otherwise unrelated budget bill. Predictably and rightly, the Senate’s nonpartisan parliamentarian shot down that gambit.

That puts Washington back at square one in its odyssey through the nation’s immigration morass, with no realistic chance of progress anytime soon. The episodic glimmers of hope for reform that have pierced the partisan gloom are dim now as Republicans, gearing up for next year’s midterm elections, prepare to run against the immigration mess, not help resolve it.

There are enormous downsides to border disorder, to immigration policy paralysis and to leaving the fates of more than 11 million current immigrants without any path to a secure future — even beyond the reinforcement it provides to the United States’ growing international reputation for dysfunction. No one gains by the chaos except smugglers who soak desperate migrants financially on their way north in hopes of a better life. The losers include not only the “dreamers” brought to this country as children, who must live in perpetual anxiety, but also the country as a whole, which loses the value of immigrants, skilled and otherwise, who would turbocharge entrepreneurship, create jobs and help the economy grow.

There are available solutions if Congress could overcome its horror of bipartisan compromise. The goal should be to establish a realistic annual quota of immigrant visas for Central Americans, Haitians and others desperate to reach this country who otherwise will cross the border illegally — a number that recognizes the U.S. labor market’s demand for such employees. That must be supplemented by a muscular guest worker program that enables legal border crossing for migrants who want to support families remaining in their home countries.

Border enforcement can be tightened. It will never be watertight, but providing migrants with a fair shot at coming to the United States to live and work legally would dampen the incentive for individuals and families to pay coyotes to help them enter without documents. It also would bolster the legitimacy and rationality of turning back migrants at the border, many or most of whom do not have legitimate claims under asylum rules.

Democrats are right to want a path to legalization and citizenship for dreamers and other migrants who have spent most of their lives in this country. Yet the Senate parliamentarian, Elizabeth MacDonough, was justified in rebuffing their attempt at a bogus shortcut to achieve that end.

“The reasons that people risk their lives to come to this country — to escape religious and political persecution, famine, war, unspeakable violence and lack of opportunity in their home countries — cannot be measured in federal dollars,” wrote Ms. MacDonough, who once handled immigration cases as a Justice Department attorney. A new law that would blaze a trail to legal status for millions of hopeful immigrants would be, she added, a “tremendous and enduring policy change that dwarfs its budgetary impact.” She might have added “urgent” and “in the country’s best interests.”