WASHINGTON/BEIRUT (Reuters) - The United States will likely end its air campaign against Islamic State in Syria when it pulls out troops, U.S. officials said on Thursday, as President Donald Trump defended the planned withdrawal against criticism from allies abroad and at home.

U.S. Defense Secretary Jim Mattis, who had opposed Trump’s decision on Syria, abruptly announced on Thursday he was resigning after meeting with the president. In a candid letter to Trump, the retired Marine general emphasized the importance of “showing respect” to allies.

NATO allies France and Germany said Washington’s change of course on Syria risks damaging the fight against Islamic State, the militant group that had seized swathes of Iraq and Syria but has now been squeezed to a sliver of Syrian territory.

Several of Trump’s fellow Republicans in Congress, joined by opposition Democrats, urged the president to reverse course, saying the withdrawal would strengthen the hand of Russia and Iran in Syria and enable a resurgence of Islamic State.

(GRAPHIC: Islamic State in Syria and Iraq - tmsnrt.rs/2Reo6JW)

Trump, however, gave no sign of changing his mind and lashed out at Senator Lindsey Graham, a Republican who is sometimes an ally of the president but who has said a withdrawal would have “devastating consequences” for the United States.

“So hard to believe that Lindsey Graham would be against saving soldier lives & billions of $$$,” Trump tweeted. “Why are we fighting for our enemy, Syria, by staying & killing ISIS for them, Russia, Iran & other locals? Time to focus on our Country & bring our youth back home where they belong!”

Trump’s troop announcement on Wednesday upended a pillar of American policy in the Middle East and caused consternation in domestic and foreign critics who argued it would make it harder to find a diplomatic solution to Syria’s seven-year civil war.

It also appeared to add momentum to Trump’s long-stated goal of extricating the United States from its 17-year war in Afghanistan. U.S. officials told Reuters on Thursday that the administration is planning to significantly draw down thousands of the 14,000 troops now in Afghanistan, where Mattis has argued for a strong U.S. military presence.

France, a leading member of the U.S.-led coalition against Islamic State, said it would keep its troops in northern Syria for now and contested Trump’s assertion that the group has been defeated in the country.

“Islamic State has not been wiped from the map nor have its roots. The last pockets of this terrorist organization must be defeated militarily once and for all,” French Defence Minister Florence Parly said on Twitter.

France has about 1,100 troops in Iraq and Syria providing logistics, training and heavy artillery support as well as fighter jets. In Syria it has dozens of special forces, military advisers and some foreign office personnel.

Trump, however, tweeted that he was fulfilling a promise to leave Syria made during his presidential campaign and arguing that the United States was doing the work of other countries and it was “time for others to finally fight.”

Four U.S. officials, who spoke to Reuters on condition of anonymity, said the troop withdrawal is expected to mean an end to the U.S. air campaign against Islamic State in Syria. The U.S.-led air war has been vital to crushing the militants there and in neighboring Iraq, with more than 100,000 bombs and missiles fired at targets in the two countries since 2015.

Still, one U.S. official said a final decision on the air campaign had not been made and did not rule out some kind of support for partners and allies.

The United States told the U.N. Security Council it was committed to the “permanent destruction” of Islamic State in Syria and would keep pushing for the withdrawal of Iranian-backed forces in the country.

The roughly 2,000 U.S. troops in Syria, many of them special forces, were ostensibly helping to combat Islamic State but were also seen as a possible bulwark against Syrian President Bashar al-Assad, who has retaken much of the country from his foes in the civil war, with military help from Iran and Russia.

FILE PHOTO: Syrian Democratic Forces and U.S. troops are seen during a patrol near Turkish border in Hasakah, Syria November 4, 2018. REUTERS/Rodi Said/File Photo

The Kurdish-led Syrian Democratic Forces (SDF), which have been fighting Islamic State with U.S. support for three years, said the withdrawal of troops would let the militants regroup at a critical stage and leave Syrians stuck between “the claws of hostile parties” fighting for territory in the civil war.

The SDF are in the final stages of a campaign to recapture areas seized by the militants.

But they face the threat of a military incursion by Turkey, which considers the Kurdish YPG fighters who spearhead the force to be a terrorist group, and Syrian forces committed to restoring Assad’s control over the whole country.

The SDF said the battle against Islamic State had reached a decisive phase that required more support, not a precipitate U.S. withdrawal.

THREAT ALIVE

Islamic State declared a caliphate in 2014 after seizing parts of Syria and Iraq. The hardline group established its de facto capital in the Syrian city of Raqqa, using it as a base to plot attacks in Europe.

According to U.S. estimates, the group oversaw about 100,000 square kms (39,000 square miles) of territory, with about 8 million people under its control and estimated revenues of nearly $1 billion a year.

A senior U.S. official last week said the group was down to its last 1 percent of the territory it once held. It has no remaining territory in Iraq, although militants have resumed insurgent attacks since the group’s defeat there last year.

Russian President Vladimir Putin said he largely agreed with Trump that the group had been defeated in Syria but added there was a risk it could recover.

He also questioned what Trump’s announcement meant in practical terms, saying there was no sign yet of a withdrawal of U.S. forces, whose presence in Syria Moscow calls illegitimate.

Israel will escalate its fight against Iranian-aligned forces in Syria after the withdrawal of U.S. troops, Prime Minister Benjamin Netanyahu said.

While Turkey has not commented directly on Trump’s decision, an end to the U.S.-Kurdish partnership will please Ankara.

Kurdish militants east of the Euphrates in Syria “will be buried in their ditches when the time comes,” state-owned Anadolu news agency reported Defence Minister Hulusi Akar as saying.

Turkey has intervened to sweep YPG and Islamic State fighters from parts of northern Syria that lie west of the Euphrates over the past two years. It has not gone east of the river, partly to avoid direct confrontation with U.S. forces.