The Middle East may have turned a page with the defeat of the Islamic State group in its self-declared capital of Raqqa, but the future is looking even more tangled, and potentially as violent.
The downfall of a common enemy could open up cracks in temporary alliances created to fight the extremists, and rivalries for influence are now likely to take centre stage.
Already, a multitude of players in the crowded theatres of Iraq and Syria are racing for the spoils of war. And while the group fights its last battles in what remains of its self-styled caliphate, world powers and smaller players alike are vying to create new facts on the ground.
SYRIAN ARMY AND ALLIES
With the pivotal capture of east Aleppo in late 2016, President Bashar Assad's government effectively neutralized its most threatening armed opposition, allowing it to train its full attention on IS.
The priority was oil-rich eastern Syria, close to the Iraqi border, and with the backing of Russia and Iranian-sponsored Shiite militias, the Syrian army has made significant advances in the area.
Tehran wants to establish a land route from Iraq through Syria, all the way to Israel's borders. Washington and Israel are wary of this expansion, and Israel has warned it will not tolerate a continued Iranian military presence in Syria.
This terrain is about to get increasingly muddied.
With the fall of Raqqa, the U.S.-backed Kurdish-led militia known as the Syrian Democratic Forces will turn its attention to Deir el-Zour province, where the race is on for control of its vital oil deposits and the border with Iraq. The Kurdish fighters have battled IS in the northeastern part of Deir el-Zour, gaining control of at least four oil fields and one natural gas installation.
The rival forces are currently positioned at nearly the same distance from the largest oil field, al-Omar, which is still controlled by IS. Assad has meanwhile vowed to retake control of Raqqa at some point. For now, the city is to be administered by a local civil council supported by the U.S.-backed SDF.
KURDISH FORCES AND U.S. SUPPORT
Starting as a small self-defence unit in northern Syria, the main Kurdish-led militia has become Washington's primary partner in Syria and is now a multi-ethnic force of Kurdish, Arab and Assyrian troops that boasts thousands of fighters. This alliance was cemented by the common goal of fighting IS, which at one point charged into Kurdish-dominated areas.
The increasing U.S. presence in the area also provided the Kurdish militia with international cover to push for their project of a federal system that would give them more autonomy.
The U.S., which maintains bases in northern Syria as well as military advisers that support the SDF, insists that it is not in Syria for the long run. But Kurdish officials stress that the Americans must stay to protect the gains against IS.
With the fight against IS winding down, cracks in the Arab-Kurdish alliance are likely to emerge as issues of governance and reconstruction take centre stage. Looking across the border, Syria's Kurds are nervous as they see Washington's support for their Iraqi Kurdish counterparts waver amid a dispute with the Iraqi government in the wake of last month's Kurdish independence vote.
While Turkey initially intervened in Syria to support rebels fighting to topple Assad, it is now mainly focused on curbing Kurdish expansion and securing its long border. Last year, its troops captured a pocket of territory inside Syria to prevent a contiguous Kurdish hold along the frontier, and earlier this month, it sent troops and tanks into Syria's northwestern Idlib province, in part to curb Kurdish expansion there.
Turkey considers the Kurdish force a terrorist organization, linked to its own home-grown Kurdish insurgency.
Ankara has been vehemently critical of U.S. support for the Kurdish militia in the fight against IS and had suggested that Turkey-backed forces liberate Raqqa. It opposes the prospect of the Kurdish-led SDF administering Raqqa, a predominantly Sunni Arab city.
IRAQ'S FALTERING ALLIANCES
In Iraq, Kurdish and Shiite forces are fighting over the spoils of the war against the Islamic State group.
Both Kurdish and Shiite militias were embedded with Iraq's armed forces in the predominantly Sunni, north, where the Kurds had the opportunity to expand their authority to include massive oil fields in Kirkuk and other territories. But Baghdad, with the help of the Shiite militias, rolled those gains back this week and for now have established themselves as the paramount powers in northern Iraq — a development that threatens to engender Sunni discontent.
In Baghdad, parties are competing for leadership of a post-IS Iraq. Prime Minister Haider al-Abadi is offering a vision of a federal system, unified under the Iraqi flag. He has to be careful to ward off any challenges from former Prime Minister Nouri al-Maliki who remains popular with the country's Shiite militias and hard-liners, many of whom want to see closer ties with Iran.
Internationally, Iran exerts the most influence on Iraqi politics, even though the U.S. maintains a massive diplomatic presence and several thousand troops in the country. But ties between the Iraqi and Iranian economies are likely to pull Iraq further into Iran's orbit, especially after the U.S. military mission to defeat IS ends.
ISLAMIC STATE GROUP
For now, the Islamic State group's biggest and most strategic presence is in and around Deir el-Zour and the border town of Boukamal, as well as territory in Iraq's sprawling Anbar province. The group also still has pockets in Syria's central province of Homs and near the capital, Damascus.
It is no longer the group's territorial reach, but its ability to conduct a low-level insurgency that is of concern. IS still boasts an active social media presence, and the U.S. military estimates around 6,500 IS fighters remain in eastern Syria and western Iraq.