As the U.S. economy softens, look for anti-immigrant sentiment to harden, at least in the short run. America has a history of welcoming foreigners in search of a better life. But we also have a habit of blaming business cycle downturns in part on our newest arrivals. In times past, that's meant scapegoating the Irish, the Italians or the Chinese for higher unemployment and slower economic growth. Today, it means blaming Latinos.

This month brought the steepest job decline in five years, and the unemployment rate has risen to 5.1%. That's still low by historical standards, but turmoil in the credit and housing markets has also led to reductions in disposable income and retail sales. Inflation is up, the dollar is weak, and polls are showing that the economy is foremost on the minds of voters. What's more, the consensus is that the situation could get worse before improving.

At the behest of unions seeking to restrict the supply of labor in order to inflate its price, pols and interest groups are already citing the state of the economy as a reason to scale back immigration. During a hearing last week, Rep. George Miller (D., Calif.) argued that before we hand out more H-2B visas for foreign seasonal workers, who come mostly from Mexico, the job prospects of Americans should be considered. "The H-2B program needs to be reformed to protect U.S. workers," he said.

How the job opportunities of U.S. workers are impacted by foreign migrants has always been one of the more contentious elements of the immigration debate. During economic slowdowns, concerns about "job-stealing immigrants" tend to grow. The common assumption is that a job filled by an immigrant is one less job for a native.

But this reasoning is based on a fundamental misunderstanding of how our labor markets operate. The U.S. job market is not a zero-sum game. The number of jobs is not static. It's fluid, which is how we want it to be. In 2006, 55 million U.S. workers either quit their jobs or were fired. Yet 57 million people were hired over the same period. In a typical year, a third of our workforce turns over.

Immigrants help keep our labor markets flexible. And flexible labor markets - the kind that minimize the costs to a business of hiring and firing employees - enable workers and employers alike to find the employment situation that suits them best. Flexible labor markets make it easier for an employee who doesn't like his job to find another position somewhere else. And flexible labor markets make it more likely that an employer will expand his workforce or take a chance on a less experienced job-seeker.

A better fit between employers and employees increases productivity and makes markets more responsive to consumer demand. In the end, employers, workers and consumers are all better off. Immigrants, be they Salvadoran dishwashers, Indian motel operators or Russian microbiologists, increase the fluidity of U.S. labor markets. These migrants fill niches with skill sets that tend to complementU.S. workers, not elbow them aside.

Living in a free-market society involves living with more economic risk. The welfare states of continental Europe offer another model for managing an economy. Italy, France and Germany are less welcoming of immigrants and feature highly protected labor markets, where the interest of the worker is placed above that of the consumer.

America's political left goes gaga over Europe's universal health care, 35-hour work week, and six-week vacation mandates. But protectionism has a downside: For decades, the Continent has had consistently higher unemployment and lower productivity than what's found here.

The economic journalist Henry Hazlitt said that when studying the effects of economic proposals, "we must trace not merely the immediate results but the results in the long run, not merely the primary consequences but the secondary consequences, and not merely the effects on some special group but the effects on everyone." Economics, in other words, is about making decisions by comparing the costs and benefits of alternative courses of action.

The question is not whether the U.S. can survive without foreign labor. The question is whether the country would be better off economically by moving in a protectionist direction. Social conservatives fret that too many immigrants will have America slouching toward Guatemala. The bigger concern is that too few immigrants will have us slouching toward France.

Mr. Riley, a member of The Wall Street Journal's editorial board, is author of "Let Them In: The Case for Open Borders," which will be published next month by Gotham.