Later this month, U.S. Secretary of State Rex Tillerson plans to host a 68-nation meeting in Washington to discuss the next moves by the coalition fighting the Islamic State, a senior Trump administration official said on Thursday.

This comes as the Islamic State, an actual state with territory and population, is on the verge of extinction, but remains a threat to the U.S. and many parts of the world. Since 2014, the group's control over people has been cut by roughly 80 percent in Iraq and 56 percent in Syria, according to our estimates. The Islamic State is also slowly but steadily losing control of its largest remaining city, Mosul. Its capital, Raqqa, has been isolated and is awaiting assault. Foreign fighter flows to the region peaked in 2016 and have drastically shrunk. Thousands of Islamic State fighters in Iraq and Syria have been killed, captured, dispersed, or driven underground.

Yet despite these successes, the collapse of the Islamic State's so-called caliphate will not eliminate the organization or other Salafi-jihadist groups, which will likely continue for years. “Tell me how this ends,” then Major General David Petraeus asked in 2003, just after American forces had taken Iraq. This question is just as pertinent today. In the short term, the threat of Islamic State-directed or -inspired attacks on the U.S. homeland and its allies overseas may even grow.

Over the past two years, the Islamic State has conducted or inspired an increasing number of terrorist attacks from Paris and Berlin to Orlando and New York even as its self-proclaimed caliphate in Iraq and Syria has shrunk. Presently, the Islamic State's global footprint includes eight formal provinces outside of the core caliphate in Iraq and Syria; dozens of additional aspirant groups; and tens of thousands of inspired and sometimes directed individuals across Asia, the Middle East, Africa, Europe, and North America.

ISIS will continue to metastasize and seek to spread its influence once it loses its home base.

The liberation of Mosul and Raqqa are important initial steps in diminishing the threat from the Islamic State. Without an actual state, the Islamic State will likely lose a substantial amount of its appeal. Without a secure territorial base to operate from, it may have a harder time organizing external attacks. Yet the Islamic State, like al Qaeda before it, will continue to metastasize and seek to spread its influence once it loses its home base.

Those foreign fighters that aren't killed will likely flee from Iraq and Syria, returning to their homelands, seeking refuge in other countries, or flocking to new jihadist battlefields. Islamic State supporters and leaders in Iraq and Syria will go underground, seeking to regroup and renew the fight by turning to guerrilla tactics. And the Islamic State will continue to orchestrate an ideological campaign on the internet and social media sites to inspire radicalization and encourage attacks.

The Islamic State is a byproduct of the American intervention in Iraq and also of its subsequent departure. The 2003 intervention shifted the political balance in the country away from the formerly dominant Sunni minority toward the Shi'a majority, leaving Sunnis disgruntled, adrift, and ripe for radicalization. The year 2011 saw both the withdrawal of American forces from Iraq and the opening of a civil war in neighboring Syria. With the advent of that civil war, al Qaeda in Iraq, soon to rename itself the Islamic State, shifted its center of gravity across the border.

The coincident American withdrawal from Iraq had several additional consequences. It removed a counterweight to Iranian influence; it halted professionalization of the Iraqi Army, and it reduced American visibility into the deteriorating condition of those forces as they became politicized, corrupted, and progressively weakened by the Shi'a-dominated regime in Baghdad. Washington was consequently taken by surprise when, in early 2014, Islamic State fighters burst out of Syria, rapidly advancing to the outskirts of Baghdad.

ISIS won't be defeated until local forces can secure liberated territory and local governments can administer them.

George W. Bush and Barack Obama both declared their wars in Iraq over. But wars don't end by fiat. It will be important that the new administration in Washington not make this mistake a third time. The Islamic State will not be defeated until local forces can secure liberated territory and local governments can effectively administer these areas. This needs to occur not just in Iraq and Syria, but in the half dozen other lands where the Islamic State has established territorial footholds, to include Afghanistan, Nigeria, Libya, and Egypt.

This challenge is particularly acute in Syria, where there is at present no acceptable local government to support. This makes the question of what to do with Raqqa once liberated particularly difficult. Even as the military campaign to take the city gains momentum, Washington will need to reengage diplomatically in the ongoing negotiations over Syria's future.

It is not accidental that the Islamic State has taken root in some of the most poorly governed countries in the Muslim world. State-building is an unpopular mission, from which successive American administrations have shied. Yet the alternative is war without end.

If the Islamic State is to be defeated and stay defeated, military measures will need to be combined with economic, technical, and political assistance designed to improve state and local capacity. Popular grievances that have given rise to extremist movements need to be better addressed. These are not steps the United States should take alone, but Washington should lead in assembling and guiding donor coalitions working with each of the affected countries.

Seth G. Jones is director of the International Security and Defense Policy at the nonprofit, nonpartisan RAND Corporation and an adjunct professor at Johns Hopkins University. James Dobbins, a veteran diplomat who most recently served as the State Department's special representative for Afghanistan and Pakistan, is a senior fellow and Distinguished Chair in Diplomacy and Security at RAND.

This commentary originally appeared on Fortune on March 9, 2017. Commentary gives RAND researchers a platform to convey insights based on their professional expertise and often on their peer-reviewed research and analysis.