President Trump’s decision to withdraw all U.S. military forces from Syria this week caught military leaders and lawmakers off-guard, drawing criticism from across party lines. But the surprise announcement also marks a rare instance in which Trump has broken strongly with his political base, which has widely supported military efforts to combat the Islamic State in Iraq and Syria.

Public opinion polls on this issue, while sporadic, have shown most Americans supported sending ground troops to battle the Islamic State in 2015. They have also found little sign that public support for military action against the Islamic State, also known as ISIS, was waning, as it had with the wars in Iraq and Afghanistan.

Trump’s withdrawal poses a test for how far Republicans will follow his lead on foreign policy, an issue that has often split the party between Trump’s strongest supporters and those who are less enthusiastic.

The most recent gauge of U.S. involvement in Syria was a July poll by the Chicago Council on Global Affairs, which found that 57 percent of Americans overall favored using U.S. troops “to fight against violent Islamic extremist groups in Iraq and Syria.” Broken down by party, support for U.S. troop involvement was highest among Trump’s fellow Republicans at 69 percent, compared with 54 percent of Democrats and 51 percent of independents who supported U.S. troops for this purpose.

The poll found a similarly wide gap even among Trump’s strongest supporters, with 70 percent of Republicans who have a “very favorable” view of Trump saying they favor using troops against Islamic extremists in Iraq and Syria. Support was also broad among Republicans who share Trump’s skepticism of international military alliances. Among Republicans who said the United States should decrease its commitment to NATO — an alliance Trump has criticized as not providing enough benefit for the United States — 62 percent favored using U.S. troops to fight against violent Islamic extremists.

Separately, a spring survey by Investor’s Business Daily and research firm TIPP found a similar pattern when asking specifically whether ground troops should be withdrawn from Syria, maintained or whether more troops should be deployed in the country.

The poll found 2 in 10 Republicans supported withdrawing U.S. troops from Syria, while nearly 7 in 10 favored maintaining the level of troops (61 percent) or deploying more troops to the country (8 percent). Among the public overall, a larger 34 percent preferred to withdraw U.S. troops, but a small majority favored maintaining ground troops (49 percent) or increasing their number (7 percent).

The violent rise of the Islamic State in Iraq and Syria appeared to trigger heightened support for military intervention among the U.S. public, who in 2013 largely opposed launching military strikes to punish Syrian President Bashar al-Assad for allegedly using chemical weapons against his citizens.

But by the fall of 2014, a Washington Post-ABC News poll found 59 percent of Americans saying ISIS posed a “very serious threat” to the vital interests of the United States, with more than 6 in 10 supporting U.S. airstrikes against Sunni insurgents in Iraq and Syria. Another Post-ABC poll that fall found 53 percent supporting sending U.S. forces to train Iraqi government troops and coordinate airstrikes.

In 2015, after a mass attack in Paris claimed by ISIS left more than 100 dead, a Post-ABC poll found 60 percent of Americans in support of increasing U.S. ground forces against the Islamic State. Support rose to 73 percent among Republicans.

Trump claimed that the Islamic State was defeated in explaining his decision to withdraw U.S. troops from Syria. While there is little recent polling on ratings of the campaign against ISIS, a CNN/SSRS poll in May 2018 found concern about it had fallen but was still substantial. A 59 percent majority said ISIS represents a “very serious threat” to the United States, down from 70 percent in early 2017 and a high of 73 percent in 2016. Republicans were 10 points more likely than Democrats to rate ISIS as a high-level threat to the United States.

Polling in the coming weeks and months will tell whether Republicans will back Trump’s pullback from intervention in Syria, which would mark a break from years of clear public support for U.S. action there. There is also the potential for an attitude shift among Democrats, who have moved strongly against Trump on a variety of issues and might respond to Trump’s withdrawal from Syria by becoming more supportive of military interventions.

Emily Guskin contributed to this report.