The controversial H-1B visa program, widely criticized for costing American workers their jobs, has actually provided economic benefits for both the U.S. and India, according to a new study from researchers at the Center for Global Development and the University of Michigan.

The combined incomes for the two countries as a result of the U.S. visa program rose by about $17.3 billion or 0.36 percent, and the total IT output from both countries rose by about 0.45 percent in 2010, say researchers Gaurav Khanna of the Center for Global Development and Nicolas Morales at the University of Michigan. While recognizing negative repercussions for some workers, the study said that on the whole U.S.-born employees were wealthier by about $431 million in 2010 because of the program.

“The average worker in each country is better off because of immigration, and U.S native workers have made big gains because of the H-1B visa program,” said Khanna.

The research report titled “The IT Boom and Other Unintended Consequences of Chasing the American Dream" is an in-depth look at the H-1B visa program and its impact on the U.S. and Indian economies since the early 2000s. The visa program allows companies in the U.S. to employ skilled foreign workers in specialty occupations.

India’s outsourcing companies, including Infosys Ltd., Tata Consultancy Services Ltd. and Wipro Ltd., have been the leading recipients of H-1B visas, which they use to send employees to work at customer sites in the U.S. The program has been instrumental in the rise of India’s $155-billion IT services industry.

But the approach has come under fire in recent years in the U.S., including from President Donald Trump. In April, his administration announced new measures to curtail the program’s use and eliminate what he called “widespread abuse.”

The program is often criticized in India too, for causing a brain drain. But the authors took issue with that assertion also, arguing that Indian workers migrating to the U.S. have led to the dramatic expansion of India’s own technology industry and contributed to a growing skilled workforce in the country. More students switched to computer science and engineering fields because of better prospects and those who did not migrate helped boost the Indian IT services industry. Some H-1B visa holders returned with additional knowledge to improve the sector.

The increase in IT sector productivity allowed India to eventually surpass the U.S. in software exports, the researchers said.

Because immigration led to better technology being built, the overall productivity of other sectors increased and consumers of computer-related goods benefited from better software and hardware prices, a 1 percent decline for U.S. IT products and a 7.4 percent decrease for Indian products.