SAN DIEGO — It seemed like a great solution to a bad problem.

Plagued by years of cuts in state funding, UC San Diego threw open its doors to Chinese students who were willing to pay three times as much tuition as California residents to attend the prestigious La Jolla school.

The money helped it hire faculty, add courses, stock the library and cover financial aid for Californians. The students also have bolstered research into everything from self-driving cars to cancer treatments.

By fall 2018, UC San Diego had 5,573 Chinese students, the most of any UC campus.

But the strategy may be unraveling.

Chinese enrollment grew by only 41 this fall after soaring by an average of 526 students a year over the last decade. Enrollment could drop in 2020.

The social and political climate has left many foreign students feeling unwelcome and unsafe, leading to a national drop in the number of newcomers seeking a spot at U.S. universities, according to the New York-based Institute of International Education.

Students have described the climate as anti-immigrant and anti-foreigner, especially against the Chinese, who account for a third of the roughly 1 million international students in the U.S. Educators say much of the tension stems from the U.S.-China trade war, which led the Trump administration to consider banning Chinese students from U.S. schools.

The idea was shelved. But the administration tightened visa restrictions on Chinese graduate students in certain areas of science and technology.

The move caused a shudder at UC San Diego, which heavily relies on the students in research that benefits companies such as San Diego-based Qualcomm, the nation’s largest chipmaker, and Northrop Grumman, the world’s fifth-largest defense contractor.

Students also are upset that the Trump administration has regularly and publicly said that Chinese scholars and students might steal intellectual property or act as spies on U.S. campuses.

“Chinese students are just purely students,” said Pengcheng Cao, a graduate student in engineering. “They are not different from young people in the U.S.”

The collective uproar is having an effect. The university said last week that it is beginning to focus less on China and more on recruiting high-paying undergraduates from other parts of the world and the U.S. No quotas have been set for these students, who are charged $30,000 more than Californians in annual undergraduate tuition.

Chancellor Pradeep Khosla signaled the change in October, telling the San Diego Union-Tribune that perhaps the time had come to recruit more aggressively from other parts of the world. But he didn’t find the situation worrisome.

“We are not losing sleep over Chinese students not coming here.... The rest of the world is open to us and people care about what we do and know what a great institution we are,” he said.

Even so, UC San Diego’s Rady School of Management has begun diversifying its student mix.

“We are certainly aware that we are one tweet away from having a significant decrease in the volume of applications from China, and we are working on ways to manage that risk,” said Shaun Carver, assistant dean of graduate programs at Rady.

He was referring to Houston Rockets general manager Daryl Morey, who angered Chinese authorities on Oct. 4 when he posted a Twitter message that said, “Fight for Freedom. Stand with Hong Kong.”

UC San Diego’s revised strategy involves challenge and risk, especially when it comes to diversifying its foreign enrollment. The campus doesn’t have a history of making such change.

The university draws students from more than 90 countries. Only five of them sent more than 100 students last fall; only one — China — sent more than 1,000. UC San Diego’s overall enrollment has soared by 12,113 since 2008. Nearly 44% of those students were from China.

There’s just as much concern about how a decline in Chinese students could affect UC San Diego’s research program, which attracts on average almost $4 million a day in new funding.

“The work they’re doing is critical for the scientific progress being made in our labs,” said Susan Shirk, chair of UC San Diego’s 21st Century China Center.

“You might say there are no substitutes because American primary and secondary education are not producing sufficient science and technology manpower for America,” she said.

UC San Diego talks about its riches so often that some may wonder why it needs to recruit out-of-state and foreign students who pay a premium to attend. The campus pulled in $1.4 billion last year for research. The school also raised $2 billion in donations over the last seven years, setting a record.

But over the last two decades, the percentage of revenue that UC campuses receive from the state fell to 6% from 25%. The crunch was made worse by the Great Recession.

Like other UC campuses, UC San Diego turned its attention to China, where there was a demand among students who want to study abroad, especially the U.S. China has experienced extraordinary economic growth since the late 1970s, creating a large middle class with disposable income.

Most families have only one child, and they cherish higher education.

“If it is within a family’s means, or even if it is borderline, they will squeeze their expenses to pay for their child’s education,” said Kun Zhang, who emigrated from China and is now dean of UC San Diego’s highly ranked bioengineering department. “This kind of thinking represents 2,000 years of Confucian culture.”

The Chinese were looking to California at the same time Californians were looking to them. Chinese students also know that “earning a degree at a UC campus and learning English means you have a much better chance of getting a good job when you go back to China.”

Educators estimate that about 80% of Chinese students return home after studying abroad, and not always for job opportunities or to see family. It is becoming harder to obtain a visa to remain in the U.S. to work.

There’s little that happens in China that escapes notice in La Jolla. UC San Diego has one of the largest, most respected group of Chinese experts in the U.S. who study topics such as divorce and the auto industry.

China’s Fudan University operates a research group at UC San Diego that serves the University of California system. And the campus hosts visiting scholars from companies such as Tencent, one of China’s tech giants.

Research is published widely and often featured in public talks. But the openness is not universal.

The Union-Tribune approached six Chinese students, but only one of whom would speak on the record and in detail. Two of the students asked if they could use single-word pseudonyms. A prominent Chinese geneticist also declined to talk.

The most common denominator: anxiety about saying or doing something that would antagonize the U.S., China — or both.

The university decided in August 2018 that it would not accept money or enter into agreements with the Chinese telecommunications giant Huawei because the U.S. government suspected the company of spying.

One UC San Diego executive said the move arose from increased pressure on large research universities from federal agencies to examine their interactions with China.

The university hastened to add that it wasn’t cutting ties with other Chinese companies, including Huami, a biometric company that last year paid UC San Diego $100,000 to be a member of the corporate affiliate program.

Like other firms, Huami wants a peek at research occurring in the Center for Wearable Sensors, which develops tiny wireless devices that monitor glucose and blood pressure levels.

UC San Diego also has been trying to reassure foreign students that they are welcome.

“Our classes are open to all students. There are no ‘secret labs’ in engineering,” said Al Pisano, dean of the Jacobs School of Engineering. “We fully subscribe to the campus and systemwide ideals of the ‘open research university.’ Staying with this philosophy will help us win the technology race in the long run.”

Robbins writes for the San Diego Union-Tribune.