After a year of controversy at the U.S.-Mexico border, Republican concern about immigration has risen sharply, rivaling international terrorism as the top security threat for the first time in more than two decades, according to a Chicago Council on Global Affairs poll released Monday.

The survey, taken in June, found that 78 percent of Republicans say large numbers of immigrants and refugees coming into the United States represent a “critical threat” to the nation’s vital interests. That marks a rise of 12 percentage points since last year. In comparison, 76 percent of Republicans describe international terrorism is a high-level threat.

Among Democrats, just 19 percent say the same, ranking it last among 14 possible concerns, including climate change, cyberattacks and foreign interference in American elections.

The findings mark the largest partisan divide over immigration in more than two decades and come after a year in which arrests of migrants crossing the U.S.-Mexico border spiked dramatically, and as Democrats fought against President Trump’s demand for a border wall.

The partisan chasm will likely become a flash point in the 2020 presidential campaign, as Trump seeks to energize his base. The issue may be far less potent in swaying political independents.

Overall, 43 percent of the public say immigrants and refugees coming to this country are a critical threat — up four percentage points from last year. Independents mirror the general public overall with 42 percent calling immigration a critical threat.

The findings on immigration show the degree to which Republicans share Trump’s views and support his aggressive policies to combat illegal border crossings. But on a variety of other foreign policy issues, Republicans’ views are closer to those of the general public than to the president’s “America First” policies.

At a time of strong partisan divisions, the poll shows a striking amount of bipartisan agreement on foreign policy goals. More than two-thirds of both Democrats and Republicans say it is best if the United States plays an active role in world affairs, something the public widely sees as encompassing trade, humanitarian aid, promoting democracy and using U.S. troops to defend allies. Fewer than half in either party say this role encompasses selling weapons to other countries.

Majorities or pluralities of the public — including both Democrats and Republicans — say security alliances with countries from East Asia to Europe to the Middle East benefit both the United States and its allies. Fewer than 1 in 4 Americans say they mostly benefit allies, with the percentages among Republicans only slightly higher.

Roughly 7 in 10 Americans say “maintaining U.S. military superiority” makes the country safer, a view that peaks at 87 percent of Republicans but is shared by 61 percent of Democrats.

Trump has complained about longtime allies taking advantage of the United States and at times has equivocated about whether the United States would automatically defend a fellow member of the NATO alliance from a Russian attack if they have not lived up to their financial obligations.

But the partisan divide is almost nonexistent in the contribution of alliances to U.S. security — 75 percent of Republicans and 77 percent of Democrats say those alliances make this country safer. When asked about NATO specifically, 86 percent of Democrats and 62 percent of Republicans say the alliance is still essential to the country’s security.

The belief in NATO’s role as essential to U.S. security has grown steadily during Trump’s presidency, with the percentage of Americans who agree with that statement rising from 65 percent in 2016 to 73 percent now.

On immigration, majorities in both parties agree on whether some specific policies would be “effective” at dealing with illegal immigration, although the strength of those majorities differs greatly. Increasing border security was rated as effective by 55 percent of Democrats and 93 percent of Republicans. Imposing new fines on businesses that hire people in the country illegally earned support from 54 percent of Democrats and 83 percent of Republicans.

Aside from tighter enforcement, the poll found about 8 in 10 saying it would be very or somewhat effective to create a pathway to citizenship for people in the country illegally who “agree to pay taxes, speak English capably, have a clean criminal record and have steady employment.” Three in four Republicans and almost nine in 10 Democrats said this would be effective.

The survey found little faith in Trump’s now-rescinded policy of separating parents and children when they are detained for entering the country. Forty percent of Republicans said this approach is effective, compared with 23 percent of the public overall and 10 percent among Democrats.

Two other issues raised in the survey produced stark partisan differences. One is climate change. Overall, a narrow 54 percent majority say climate change represents a “critical threat” to U.S. interests, the highest point in Chicago Council polling since 2008. Yet while 78 percent of Democrats say climate change is a critical threat, just 23 percent of Republicans agree. That 55-point partisan gap has grown from 39 points in 2016 and is the highest ever in Chicago Council polls.

China marks another issue dividing partisans. The president’s tough posture toward China, embodied in both the trade war he set off by imposing tariffs on Chinese imports and with his sometimes confrontational rhetoric, appears to have influenced Republicans far more than Democrats on seeing China as a threat.

The survey found that 54 percent of Republicans now see China’s rise to a world power as a global threat. That is up 12 points since last year and is the highest since 2002 in Chicago Council polls. That compares with 36 percent of Democrats and 40 percent of independents.

Republicans also offer far more support for the president’s tariffs on China, with 74 percent in agreement compared with 30 percent of Democrats.

The Chicago Council survey was conducted online June 7-20, 2019, among 2,059 adults nationwide. The sample was drawn through Ipsos’s KnowledgePanel, an ongoing survey panel recruited through random sampling of U.S. households. The margin of sampling error for overall results is plus or minus 2.3 percentage points.

Emily Guskin contributed to this report.