Brett McGurk, the U.S. envoy to the international coalition fighting the Islamic State, has resigned in protest of President Trump’s decision to abruptly withdraw U.S. troops from Syria.

His resignation, confirmed by a State Department official familiar with the matter, comes on the heels of Defense Secretary Jim Mattis’s announced departurebecause of differences with the White House over foreign policy, immediately following Trump’s announcement on Syria. Mattis said he would stay on until February to ensure a smooth transition.

Both Mattis and McGurk objected to what they saw as a shortsighted decision and a breach of faith with U.S. allies including the Syrian Kurds, who fought alongside U.S. forces in Syria and now face a dangerous and uncertain future.

For Trump, the long-serving officials are the first high-profile departures in protest of his policy decisions.

McGurk had already planned to leave by mid-February to take up a year-long post at Stanford University in March. Instead, he submitted his resignation letter, effective Dec. 31, to Secretary of State Mike Pompeo late Friday.

In a tweet Saturday evening, Trump asked if McGurk was a “Grandstander.” “The Fake News is making such a big deal about this nothing event,” Trump wrote.

The resignations send a worrying signal to foreign partners whose support is crucial to containing the Islamic State, former officials said.

Trump this past week ordered the withdrawal of all 2,000 or so U.S. troops from Syria and declared the Islamic State defeated. The move blindsided senior officials and ran counter to the advice of his own top aides, including Mattis.

“We have defeated ISIS in Syria, my only reason for being there during the Trump Presidency,” Trump tweeted on Wednesday, a day before Mattis announced his resignation.

But earlier this month, McGurk said that the Islamic State was far from vanquished despite its loss of territory. “Nobody working on these issues day-to-day is complacent. Nobody is declaring a mission accomplished,” McGurk said at a State Department briefing. “Defeating a physical caliphate is one phase of a much longer-term campaign.”

McGurk, appointed to the job in 2015 by President Barack Obama and retained by Trump, had long maintained that the U.S. mission in Syria should focus on countering the Islamic State rather than wider regional ambitions such as the overthrow of Syrian President Bashar al-Assad, said diplomats who worked with him over the years.

Like many administration officials dealing with counter-Islamic State policy, McGurk was taken aback when Trump national security adviser John Bolton announced in September that U.S. forces would stay there for the indefinite future as part of a plan to counter Iran — a new goal for the deployment. “We’re not going to leave as long as Iranian troops are outside Iranian borders and that includes Iranian proxies and militias,” Bolton said.

At the time, the Syria policy had been loosely based on a likely drawdown by the end of 2019, and McGurk and others were doubtful that Trump, who had repeatedly insisted he wanted to leave Syria, was fully cognizant of or had signed off on the new decision.

McGurk, meanwhile, was seeking to stabilize the eastern third of Syria, which had been liberated from the militants and was under U.S. control. Trump had announced that the United States would no longer pay to help restore vital services such as electricity and water to towns and cities destroyed by combat, including heavy U.S. air bombardment, and McGurk successfully solicited coalition contributions to cover the financial shortfall.

Aside from Mattis’s resignation, the most significant factor in McGurk’s decision was an inability to reconcile the president’s decision with his experience as the U.S. diplomat who “spent time with the guys on the ground who have been fighting and dying,” including Kurdish fighters in Syria, said an official familiar with his views. “To just suddenly, in one split second” have to tell them the United States was leaving “is hard to face.”

Even so, the official said, McGurk had always told the fighters that “you cannot count on us for a long-term stay,” and advised them to start thinking about Syria’s future after the Islamic State’s defeat. Numerous U.S. officials have said that final territorial defeat remains months away and that thousands of militant “sleeper cells” throughout Syria have been conducting guerrilla attacks in liberated areas and are awaiting a U.S. departure to reorganize.

The United States began airstrikes in 2014 against Islamic State strongholds in Syria, a country already riven by civil war. U.S. ground troops entered the country in 2015 to provide support to the Kurdish-led forces fighting the militant group.

McGurk, who played a leading role in negotiating the 2011 U.S. withdrawal from Iraq for Obama, sought ways to forge alliances in a region rife with sectarian and other rivalries. He was, for instance, the driving force behind the creation of the Syrian Democratic Forces, led by Kurds but also including Arabs — a move that he hoped would assuage Turkish concerns. The Syrian Kurdish militia, the YPG, is closely affiliated with the Kurdistan Workers’ Party, regarded as a terrorist organization by both Turkey and the United States.

The move, though, never fully satisfied any of the parties. And with the pending U.S. withdrawal, what happens to the SDF’s 60,000 fighters is unknown. Speculation has ranged from an all-out battle with Turkish forces currently massed on the border to a Kurdish deal with Assad that would put the SDF under the control of Assad allies Russia and Iran.

Several U.S. officials said Friday that the ongoing status of the U.S. air war, which has been engaged in daily strikes against a remaining ISIS pocket in southeastern Syria, also remains unclear.

McGurk’s tenacity and personal touch in building relationships served the counter-ISIS effort well, colleagues said. He met face-to-face with Kurdish and Arab leaders of the SDF and was a constant presence in Baghdad and Irbil, the capital of the autonomous Kurdish region in northern Iraq, becoming the most recognizable American official in the country at a time when an Islamic State blitz threatened both capitals.

“At the end of the day he was focused on defeating ISIS,” said one former official, speaking on the condition of anonymity because of the matter’s sensitivity. “All of his engagements make this [Syria decision] untenable because there’s a betrayal to foreign partners.”

McGurk valued partnerships, not only with the Kurds but with the British and the French, opposing a rapid withdrawal that left the U.S. commitment to those partners in limbo, said one diplomat, who was not authorized to speak about U.S. personnel.

His departure is likely to complicate the counter-ISIS effort, former officials said. “Anybody coming into this role will have a very difficult time being credible with our foreign partners,” said Nicholas Rasmussen, former director of the National Counterterrorism Center under Obama and Trump. “Obviously our diplomats are only as credible as the willingness of their country to live up to their commitments, and that has been undermined significantly in this case.”

Liz Sly in Beirut, Tamer El-Ghobashy in Toronto and Anne Gearan in Washington contributed to this report.