Markets are among mankind’s most powerful inventions. Although they have existed in some form for several millennia, it is only in the past few centuries that we have used them to organize entire economic systems.

Once we turned them loose, we unleashed a period of global growth unlike anything that had come before. They are not perfect, but they are truly remarkable and, like most economists. I am a big fan.

Prices are set and resources are allocated based on supply and demand. Innovation is encouraged and rewarded through the potential for profits on goods and services people want or need. Efficiency is mandated by the presence of or threat of entry by other producers. Competition leads to greater consumer choice and better pricing. Markets don’t do everything, and there are certainly times when some type of intervention is helpful or necessary, but, in general, market forces optimize resources to the benefit of all. Simply stated, markets see problems and solve problems!!

What a lot of people have evidently forgotten amid all of the rhetoric of the day is that the increasing levels of immigration in recent years are simply an example of this process at work. Let’s step away from all of the controversy for a moment, and look at the big picture.

As the baby boomer generation began to age, it became apparent that a labor shortage was looming. Markets got about the business of solving the problem in multiple ways – after all, that’s what markets do. There were massive investments in technology that substituted capital for labor or made existing labor more productive. Accommodations to keep people in the workforce also developed. Options such as flex time, job sharing, and working at home are now common, and many workplaces offer day care and even parent care on site. Retirees have also been rehired on a part-time or consulting basis. In addition, companies are seeking and hiring workers from elsewhere through immigration — skilled and unskilled — documented and undocumented.

Immigrants are a vital part of the U.S. economy. The foreign-born population reached 43.2 million in 2015 (according to the Pew Research Center), and immigrants account for 13.4 population of the U.S. population. That level is almost triple the share in 1970, and is only slightly below the all-time-high level of 14.8 percent immigrant which was way back in 1890. About 11 million of these immigrants are unauthorized.

The Pew Research Center estimates that in 2014, about 27 million immigrants were working in the United States, which is about 17 percent of the total workforce. Most of them are working legally, but about eight million were undocumented. Lawful immigrants are most likely to be employed in professional, management, business, or service jobs. Undocumented workers are most likely to be working in service or construction jobs.

Immigration fluctuates with the economy, particularly within the undocumented segment. During the 1990s and early 2000s when the U.S. economy was expanding, the unauthorized immigrant population was also rising. However, during the Great Recession, more people were leaving than entering, and the undocumented population decreased. Since that time, it has remained fairly stable. The number of unauthorized immigrants in the US labor force has been in the range of eight million or so for several years, which is about five percent of the total workforce (they make up about ten percent of the Texas workforce).

Given that most economists feel that the United States is currently at full employment, it would clearly be difficult to maintain current growth patterns without immigrants. In the future, immigrants and their children are likely to be an increasingly crucial aspect of the workforce as the U.S. population ages and baby boomers continue to retire.

Immigrants and, in particular, the undocumented population function as a flexible part of workforce, rising and falling with economic conditions. However, the process is riddled with inefficiencies, risks, and other problems because we don’t recognize it for what it is: an essential way for U.S. companies to get the workers they need. It is no different than new technology or various workplace enhancements – it is the refection of the market solving a problem.

Given this phenomenon, it makes perfect sense to enact reforms that allow the market to work better, thus allowing workers to enter and exit the country as needed. The risk to all parties could be eliminated, as well as much of the social cost. The artificial barriers that are now in place do nothing but drag down our economic potential. The market saw a problem. The market found a solution. If we would allow the market to do its work better, efficiency would be optimized, with greater prosperity as a result.

Editor’s Note: The main image accompanying the above guest column shows supporters of immigrants’ rights marching in downtown Washington, D.C., on Thursday, Feb. 16, 2017 (Photo: AP)