Ruchir Sharma, chief global strategist at Morgan Stanley Investment Management, is the author of “The Rise and Fall of Nations: Forces of Change in the The Post-Crisis World,” from which this essay is adapted.

A robot collects dishes to be cleaned at Chilli Padi Nonya Cafe in Singapore. (REUTERS/Edgar Su)

The United Nations forecasts that the global population will rise from 7.3 billion to nearly 10 billion by 2050, a big number that often prompts warnings about overpopulation. Some have come from neo-Malthusians, who fear that population growth will outstrip the food supply, leaving a hungry planet. Others appear in the tirades of anti-immigrant populists, invoking the specter of a rising tide of humanity as cause to slam borders shut. Still others inspire a chorus of neo-Luddites, who fear that the “rise of the robots” is rapidly making human workers obsolete, a threat all the more alarming if the human population is exploding.

Before long, though, we’re more likely to treasure robots than to revile them. They may be the one thing that can protect the global economy from the dangers that lie ahead.

An increase of 2.5 billion people may sound catastrophic. But what matters for economic growth is not the number of people but the rate of population growth. Since its peak in the 1960s, that rate has slumped by almost half to just 1 percent, and the U.N. forecast assumes that this slowdown will continue. Women are having fewer children, so fewer people are entering the working ages between 15 and 64, and labor-force growth is poised to decline from Chile to China. At the same time, owing to rapid advances in health care and medicine, people are living longer , and most of the coming global population increase will be among the retirement crowd. These trends are toxic for economic growth, and boosting the number of robots may be the easiest answer for many countries.

One simple way to estimate how fast an economy can grow is by adding working-age population growth and productivity growth: If the number of workers and output per worker are both increasing by 1 percent a year, then economic output should rise by roughly 2 percent. Over the past decade, both sides of that equation have declined dramatically across the world. In the United States, productivity growth has fallen by almost half from its postwar average, but growth in the labor force has slid even faster, dropping by two-thirds to an average pace of 0.5 percent, according to calculations performed for my book. Though many explanations have been offered for the slow recovery from the global financial crisis of 2008, the clearest answer may be aging populations. Something will have to fill the void left by, say, retiring farmers, and particularly at a time of rising hostility to immigrants, it is likely to be farmbots.

It may not be long before economists are worrying about a global shortage of robots. In many industrial countries, from Germany to Japan to South Korea, growth in the working-age population has already peaked, acting as a drag on the economy. Widely overlooked, however, is the fact that the population-growth slowdown is unfolding even faster in the emerging world, according to my research.

Consider the turning point that China hit last year. For the first time since records began in the 1950s, its working-age population growth was negative. As a result, China’s labor force is expected to lose 1 million workers each year for the foreseeable future, and it is also aging rapidly. Studies by Evercore ISI, a research firm, show that the elderly share of the population is rising more than twice as fast as it did in the United States and more than four times faster than in France at similar stages of development. Asked by an alarmed dinner companion about the threat robots posed to jobs in China, Nobel economist Daniel Kahneman responded: “You just don’t get it. In China, the robots are going to come just in time.” No wonder Beijing now offers heavy subsidies to companies involved in industrial automation.

And timing is critical. Those who fear the job-destroying impact of machines say this generation of technology is different because it is coming so fast. If older generations created tools for use by humans, such as sewing machines, the new forms of automation are imbued with artificial intelligence, capable of “machine learning” and of rapidly replacing humans in a broad swath of jobs, from manufacturing to services — even jobs that involve writing about robots. Concern about this disruptive advance has been stirred up by authorities such as Oxford University researchers Carl Benedikt Frey and Michael Osborne, who predicted in 2013 that nearly half of U.S. jobs would be at risk from automation in the next decade or two.

These alarms have sounded before, however. The Machine Intelligence Research Institute at the University of California at Berkeley has found that today, the average forecast for when artificial intelligence will arrive is about 20 years. But that was also the standard prediction in 1955. And often, humans find a way of working with their automated creations. After the introduction of supermarket scanners, the number of cashiers grew. Though legal-discovery software appeared to threaten the jobs of paralegals, their ranks increased, too. Now, many fear that self-driving trucks will displace millions of American truckers, but they may create more and better jobs for those who service those increasingly complex vehicles.

If automation was displacing human workers as fast as implied in recent books like Martin Ford’s “The Rise of the Robots,” then we should be seeing a negative impact on jobs already. We’re not. Since 2008, economic growth has been weak compared with that in other post-crisis recoveries, but job growth in the major industrial countries has been relatively strong. In the Group of Seven, the world’s top industrial countries, unemployment has fallen faster than expected in the face of weak economic growth, and faster than in any comparable period since at least the 1970s. The Japanese economy is growing at 0.8 percent, yet it is at full employment. According to my research, the job picture has been particularly strong in Germany, Japan and South Korea — the industrial countries that employ the most robots .

True, robots do represent a new obstacle for some poorer nations, namely those few that do not suffer from population decline. In the postwar era, countries like China escaped poverty by moving a rising young population off the farm and into more productive jobs in factories. Indeed, it was unusual for any country to sustain rapid growth unless the working-age population was increasing faster than 2 percent a year. My analysis shows that, in the 1980s, 17 of the 20 largest emerging economies had a working-age population expanding that fast, according to my research, but now there are only two: Nigeria and Saudi Arabia. And they will have a hard time moving a large segment of their young populations into industrial jobs, given that they now have to compete with robotic manufacturing elsewhere.

Yet for the rising number of countries facing population decline, the effort to lift the labor force has begun. Starting in the 1980s, led by Singapore, nations from Chile to Australia have offered baby bonuses for women to have more children, but many have found that these bonuses are ineffective in the face of stronger cultural forces, including the desire of many women to pursue a career before having children. Others have tried with some success to boost the workforce directly by raising the retirement age, offering women incentives to join or return to the labor force after having kids, and opening doors to immigrant workers.

The simple math, however, shows that particularly in rapidly aging, conservative societies such as Japan and Germany, none of these groups has the potential to make up for coming declines in the working-age population. Germany decided to admit roughly 1 million refugees in 2015, in part for economic reasons, but the resulting controversy has reduced the flow. Germany would have to admit 1.5 million each year through 2030 to fully offset the economic impact of its aging population. Japan, which on average admits fewer than 70,000 immigrants per year, would have to admit 1 million annually. Given the widespread political backlash against immigration, increases this large are unlikely.

So far, robots are drawing comparatively little populist fire, perhaps in part because their numbers are still quite low. Worldwide, the industrial labor force includes about 320 million humans, compared with just 1.6 million robots. That’s a huge gap, even counting the superior strength and speed of the robots. And most of them fall in the category of unintelligent machines, committed to a single task such as turning a bolt or painting a car door. Nearly half of them work in the auto industry, which is still the largest employer (of humans) in the United States.

In the future, economists may start counting robots the way they now count gains in the working-age population, as a driver of growth. For much of the world, robots will stand alongside immigrants, women and the elderly as a fourth pool of labor.

Whether by design or accident, many of the countries with the most rapidly aging populations already have the most robots. According to the International Federation of Robotics, the nations with the highest density of industrial robots include South Korea, with 531 per 10,000 employees, Japan with 305 and Germany with 301. The United States ranks eighth with 176. China is well behind with only 49, but on the bright side — arguably — it had the world’s fastest-growing robot population.

Today, population trends are the most powerful force shaping the rise and fall of nations, the starting point of any discussion about an economy’s prospects. Most of the world is graying fast, and the economic answer to aging will be all hands on deck, no matter what they’re made of.