In November 2016, shortly after the presidential election, students from six U.S. universities appeared in a promotional video titled “You Are Welcome Here.” Their message intended to reassure the one million international students already in the country—and the ones who might be rethinking their plans—that they were still valued.

Today, more than 300 schools participate in the #YouAreWelcomeHere campaign. But as students return to campus for the fall semester, shifting immigration policies have put that message in doubt.

Some of those policy changes have affected the F-1 visa, which allows international students to stay after graduation to pursue additional training. Students who participate in a federally designated university program in STEM can remain for up to three years, for what’s officially known as “optional practical training.” In order to qualify, they have to line up jobs before graduating, then submit training plans for approval by their schools.

Later, those scientists and software developers may either apply for an H-1B visa or return to their home countries with substantial work experience. For those who hope to secure an H-1B visa, which allows foreign-born people with specialized skills to work in the United States, the odds are low. There are only 85,000 of the visas available each year. Big outsourcing companies have learned to game the system, and the 20,000 slots set aside for international students who earn a master’s degree in the U.S. fill up quickly. Because people can reapply each year, those with an F-1 visa who remain for their STEM training essentially get more chances to win the H-1B lottery.

The training program, which was created in 1992 and extended the amount of time STEM graduates can participate in 2016, is popular with both international students and the U.S. universities that compete to enroll them. Though the H-1B visa is better known, there are many more F-1 visa recipients—nearly 400,000 last year. (Unlike the H-1B, the F-1 does not have a strict cap.) Under the Trump administration, though, the program increasingly appears under threat.

Recent administrations have described an ongoing shortage of STEM graduates as an urgent problem; the Bureau of Labor Statistics estimates that there will be 1 million job openings in computer occupations—the field expected to dominate STEM growth—from 2014 to 2024. But even though a growing number of students in the U.S. are earning bachelor’s degrees in computer science, they can’t keep pace with the number of available jobs.

The F-1 program has provided one avenue to do so. In the past, graduates participating in optional practical training could work in the U.S. for only one year. In 2008, though, the George W. Bush administration extended the amount of time international students in STEM optional practical training could stay, from 12 months to 29 months. In 2016, the Obama administration extended the window further, to 36 months. As a result, the number of international students in STEM fields approved to work in the U.S. after graduation jumped from about 34,000 in 2008 to 172,000 in 2016, according to the Pew Research Center, in an analysis of 1.5 million college graduates who participated in the optional practical training program between 2004 and 2016. Despite concerns about fake universities and visa fraud, the Pew research shows that the vast majority of graduates in the optional practical training program attend public universities or private, nonprofit colleges, not for-profit schools.

Last year, President Donald Trump directed Betsy DeVos, the secretary of education, to makepromoting high-quality STEM and computer-science education a top priority. But when it comes to developing a STEM workforce, Trump has been most intent on training Americans, in particular. In July, he signed an executive order establishing a National Council for the American Worker, focused on “the skills crisis and the importance of STEM education.” The order quotes Trump as saying, quite explicitly, “We want to make sure that we have the workforce development programs we need to ensure these jobs are being filled by American workers.”

Partly because of stricter immigration policies but perhaps also because of Trump’s rhetoric, the number of F-1 visas is down 17 percent from 2016,and well below the recent peak of nearly 645,000 visas in 2015. The U.S. government does not disclose how many applications it receives or how many it rejects. In August, chief executives of companies such as Apple, JPMorgan Chase & Co., and Pepsico sent a letter to D.H.S., saying that making it harder for high-skilled workers to stay in the U.S. will hurt the economy.

The consequences of violating the program’s terms are also becoming more severe. The U.S. Citizen and Immigration Services agency recently issued a policy memo that changed how it calculates the length of time that students on F-1 visas would be considered unlawfully residing in the United States, allowing for more punitive penalties. The longer a person stays unlawfully, the greater the penalty, which can range from being barred from the U.S. for three years to up to 10 years. About 6 percent of all F visa holders—who include F-1 recipients, their spouses and children, and students who commute from Canada or Mexico to attend U.S. colleges—stay longer than legally permitted.

The Trump administration narrowed the employment options for F-1 visa holders, through aquiet edit, in January, to the Department of Homeland Security website. According to the new program description, students could no longer qualify for the F-1 visa if they work for a staffing or temporary agency that will send them to a client’s job site. They had to receive their training at the office of the company that hired them. The D.H.S. said the change provided more oversight and helps to ensure students fulfill their training plan. Students, employers, and schools could be penalized for failing to comply. It’s not clear what percentage of people with F-1 visas work for staffing agencies. Following a lawsuit by ITServe Alliance, a trade association representing those agencies, the D.H.S. again modified its website in August, removing most of the new language but leaving unclear how the rules will be enforced.

Some American tech workers have objected to the optional practical training program, saying that it unfairly increases competition. The Washington Alliance of Technology Workers, a union local representing Microsoft contract employees, sued the D.H.S. over the 2016 rule that allowed STEM graduates to stay in the U.S. longer, arguing that it discriminated against American tech employees. (The case is pending in U.S. District Court in Washington, D.C.) In 2014, the four largest employers of those enrolled in the optional practical training program were Amazon, Intel, Qualcomm, and Microsoft.

Any broad argument that skilled foreign workers hurt U.S.-born ones, though, is probably overstated. Some research indicates that holders of H-1B visas, which many STEM graduates hope to eventually secure, depress the earnings of American workers. It’s hard to argue, though, that U.S.-born workers in STEM fields are hurting for jobs. In August, the unemployment rate for workers in computer and mathematical occupations was 2.5 percent.For workers in the life, physical, and social sciences, the unemployment rate was also 2.5 percent;for architects and engineers, 1.3 percent.

Meanwhile, the downsides of diminishing the program are clear. Since 2016, universities have increased their efforts to have programs listed as STEM-designated by the D.H.S., to better compete for international students—even in areas that haven’t traditionally been thought of as belonging to that category. Yale, Princeton, and Brown have reclassified their economics majors as STEM programs. The University of Illinois at Urbana-Champaign did the same for its graduate accounting programs. (To earn the designation, programs often have to redesign their curriculum, and they generally need approval from state boards of higher education.)

The University of Wisconsin-Madison advertises that two of its specialized MBA programs, in operations and technology management and supply-chain management, were the first U.S. MBA programs to earn STEM designations. Greg DeCroix, the director of the MBA in supply-chain management,told me in an email, “We are seeing very high-caliber international applicants these past few years—excellent academic credentials and great work experience—and we believe the STEM designation has contributed to that.”

The fate of the optional training program could be critical for universities. International students make up about 80 percent of full-time graduate students in the United States in electrical engineering and computer science, and faculty rely on them for research assistance. For many U.S. universities, cautions the National Foundation for American Policy, a nonprofit research and public-policy group, the loss of many international students from STEM fields, due to the shrinking of the F-1 program or other policies, “would cause science and engineering programs to shrink or disappear.”

That would leave the U.S. less prepared to compete globally and to develop its own workforce. China and the U.S. are vying for dominance in artificial intelligence, which requires computer-science training. The U.S. lags countries such as South Korea and Germany, according to an Economist Intelligence Unit study, in preparing students to work with computational thinking, AI, and robotics.

In October, the National Foundation for American Policy raised concerns that the White House could try to eliminate the STEM optional practical training program entirely. It cited the administration’s “Buy American and Hire American” executive order, implemented last year, which gave the D.H.S. abroad mandate to “protect the interests of United States workers in the administration of our immigration system.” That position paints immigrants as an economic threat; in fact, historically, they have been an economic engine. Other countries recognize this: Even as the U.S. makes it harder for universities to attract foreign-born students, Germany is working to enroll more of them. It’s an issue the U.S. will have to figure out, and soon—before high-value jobs go unfilled.