During a visit to the United States in 2000, then-Indian Prime Minister Atal Bihari Vajpayee was offered high praise for the booming American economy and its ripple effect on the rest of the world.

“Your successes have put India in a very positive light and have shown us what is possible in India,” Vajpayee to me in a one-on-one meeting during his visit. He also said he would love to see Indian-American entrepreneurs return home to help build India’s nascent technology industry.

Presidents Bill Clinton, George W. Bush, and Barack Obama all granted him his wish with their flawed immigration policies. The U.S. admitted hundreds of thousands of foreign students and engineers on temporary visas but did not have the fortitude to expand the numbers of green cards. The result was that the wait times for permanent resident visas began to exceed 10 years for Indian and Chinese immigrants and they began returning home.

Today, with his constant tirades against immigrants, particularly from what he calls “shithole countries,” President Donald Trump, is giving other countries the greatest gift of all: causing the trickle of returning talent to become a flood.

This gift has already done wonders for China. One measure of the globalization of innovation is the number of technology start-ups with post-money valuations of $1 billion or higher. These companies are commonly called “unicorns.” As recently as 2000, nearly all of these companies were in the U.S., and countries like China and India could only dream of being home to a Google, Amazon or Facebook.

India is about to experience a technology boom that will transform the country.

But now, according to the South China Morning Post, China has 98 unicorns, or 39 percent of the world’s 252 unicorns. In comparison, America has 106, or 42 per cent, and India has 10 unicorns, or 4 percent. An analysis by the National Foundation for American Policy revealed that 51 percent of the unicorns in the U.S. have at least one immigrant founder. It is clear how shortsighted the U.S. government has been.

For India, the timing of Trump’s tirades could not be better. With hundreds of millions of people now gaining access to the internet through inexpensive smartphones, India is about to experience a technology boom that will transform the country. And with the influx of capital and talent, it will be able to challenge Silicon Valley — just as China is doing.

Therein lies the irony of America’s rising nativism and protectionism.

When I met Vajpayee, I was the CEO of a technology startup in North Carolina. Later, I became an academic and started researching why Silicon Valley was the most innovative place on this planet.

I learned that it was diversity and openness that gave Silicon Valley its global advantage; foreign-born people were dominating the Valley’s entrepreneurial ecosystem and fueling U.S. innovation and job growth. My research teams at Duke, UC Berkeley, NYU, and Harvard documented that, from 1995 to 2005, immigrants founded 52 percent of Silicon Valley’s technology companies. They came from almost every nation in the world — from Australia to Zimbabwe.

Immigrants also contributed to the majority of patents filed by leading U.S. companies: 72 percent of the total at Qualcomm; 65 percent at Merck, 64 percent at General Electric, and 60 percent at Cisco Systems. Surprisingly, 40 percent of the international patent applications filed by the U.S. government also had foreign-national authors.

We also learned protectionist demands by nativists were causing American political leaders to advocate immigration policies that were choking U.S. innovation and economic growth. The government would constantly expand the number of H1-B visas in response to demands of business, but never the number of green cards, which were limited to 140,000 for the key employment categories. I estimate that today, there are around 1.5 million skilled workers and their families who are stuck in immigration limbo because of this.

I also saw the change in attitude in my foreign students. It used to be the norm for bachelors and masters students who came to the U.S. from China and India to want to stay permanently because there were hardly any opportunities back home. This changed. My engineering students began to seek short-term employment in the U.S. for experience after they graduated, but their goal was to return home to their families and friends. Human-resource directors of companies in India and China began to tell me that they were flooded with résumés from students from U.S. colleges.

For students, the prospect of returning home and working for a hot company such as Baidu, Alibaba, Paytm, or Flipkart is often more enticing than working for an American company, given that delays in visa processing will lock them into a menial position for longer than a decade during the most productive parts of their careers.

The U.S. share of successful technology startups will undoubtedly continue to shrink and Silicon Valley will see competition like never before. More sadly, America is losing jobs — and competitiveness — because of its shortsighted immigration policies.

Editor’s note: A version of this article first appeared in the Hindustan Times, and is being republished here with the paper’s permission.