Just days before submitting his resignation, U.S. special envoy Brett McGurk, who heads the global coalition to defeat the Islamic State, said in an exclusive interview that putting an end to ISIS will be a long-term, multiyear effort.

"We're on track now over the coming months to defeat what used to be the physical space that ISIS controlled," McGurk told CNBC's Hadley Gamble. "That will not be the end of ISIS."

The conversation with McGurk took place on Dec. 15 at a security forum in Doha, Qatar. Just four days later, President Donald Trump would declare the Islamic State defeated and announce the withdrawal of all U.S. forces fighting ISIS from Syria.

"Nobody is naive," McGurk said less than a week before Trump's decision. "The small clandestine cells, the individual terrorist attacks, will remain a threat for some time. That is why we have to remain together as a global coalition to keep the pressure on."

McGurk submitted his resignation on Friday, effective Dec. 31, a State Department official said on Saturday. A person familiar with the matter said McGurk quit because he objected to President Donald Trump's decision to pull out U.S. troops from Syria, a decision followed by the resignation of U.S. Defense Secretary James Mattis a day later.