The fighting and bombings in Damascus suggest the regime of Syrian President Bashar al-Assad is finally coming to an end. It will likely be ugly and dangerous. Some kind of international peacekeeping force is probably going to be needed, perhaps sooner rather than later.

The brutal and violent civil war between Assad loyalists and the rebels has served to inflame bitter sectarian tensions in Syria. Many Sunnis hated the long dominant Alawite minority and its Christian supporters before the conflict began in March 2011. After all, Bashar’s father, Hafez al-Assad, killed up to 20,000 Sunnis in Hama in February 1982. It was an appalling mass slaughter. The legacy of Hama terrified Syrians for 30 years. After the many massacres of the last year, the Sunni desire for revenge has only become stronger.

So, paradoxically, one of the priorities of the international community after Assad falls will be to protect the Alawite community and its allies from vengeance. Most live along the mountainous coast bordering the Mediterranean Sea, and they may try to set up a ministate there, an Alawi fortress to protect themselves. That would only prolong the civil war. A peacekeeping force to protect the region makes sense. Since many Alawis and most Christians live outside the coastal region, some means of ensuring their safety will also be needed in the rest of the country as well. It will need to be strong enough to deter revenge, but also credible and impartial enough to gain Sunni support.

Bashar also sits on the Arab world’s most lethal arsenal of weapons of mass destruction, hundreds of chemical warheads and dozens of Scud missiles that can deliver them anywhere in the Levant. Now there are reports that the regime is moving these weapons out of their usual storage facilities for reasons unknown. They will need to be secured.

Like almost everything else in Bashar’s Syria, the country’s arsenal of missiles and chemical weapons is his father’s legacy. After Syria was defeated by Israel in Lebanon in 1982, Hafez ordered the development of chemical weapons as a deterrent against his Israeli enemy. Syrian scientists developed an effective chemical-weapons program using the nerve agent sarin, a substance discovered by German scientists in the 1930s that is 500 times more toxic than cyanide. Syria paired the nerve agent with Scud missiles acquired from the Soviet Union in the mid-1980s.

Would Bashar use chemical weapons against his own people? We can’t rule it out as the regime collapses. Using them on Syria’s Sunni Muslim majority would antagonize the entire world and set Bashar and his cronies up for even more war-crimes trials. It would mean terrible reprisals by the Sunni sooner or later. Would he fire some Scuds at Israel as a final act of vengeance against the Jewish state? We can’t rule that out either.

The fact of Syria’s chemical and missile arsenal is well known to NATO governments and Israel. There is no reason it should discourage support for ending the Assad dictatorship. It does argue for caution in how to do so. Any military operation to end the Syrian civil war or a peacekeeping for after Assad collapses needs to be prepared to operate in a deadly chemical environment.

The end game in Syria is particularly bad news for Iran and its Lebanese ally Hizbullah. Syria has been Iran’s key ally in the region since the early 1980s, when the two states collaborated to create Hizbullah after the Israeli invasion of Lebanon in June 1982. Its first act of terror was to murder my boss Bob Ames and several other CIA officers by blowing up the American Embassy in Beirut. Syria has been a major source of Hizbullah’s missiles (now estimated to number more than 50,000) since the 2006 Israel-Lebanon war. Bashar is a particularly enthusiastic Hizbullah supporter, and there is a good chance he will try to get at least some of his chemical arsenal into its hands now.

What comes after Assad is unknowable today. It could be chaos like the Lebanese civil war in the 1970s. A Sunni military dictator may emerge. The Muslim Brotherhood, which led the 1982 Hama revolt and plays a large role in the current insurrection, may emerge dominant. Almost any conceivable successor regime to Assad’s will likely be hostile to Hizbullah and Iran. A hostile Syria will find many allies in Lebanon eager to turn on Hizbullah.

Hizbullah may already be preparing for a post-Assad world. Former Israeli national security adviser Uzi Arad has blamed Hizbullah for the deadly bombing in Bulgaria that killed Israeli tourists this week. Arad believes it was retaliation for the Israeli assassination of Hizbullah master terrorist Imad Mughniyah in Damascus in February 2008. It may also be Hizbullah’s effort to refocus Arab attention on Israel and away from the Syrian end game. That would also be very dangerous. The Mossad appears to have foiled another plot in Cyprus on July 7 to attack Israeli tourists there. It is too soon to come to hard judgments about these attacks—other evidence points to al Qaeda, which has attacked Israeli tourists before in Kenya—but it suggests that a very hot summer in the Middle East is getting hotter.

Any international effort to get a peacekeeping force into Syria will need Turkish assistance and bases. Jordan can play an important supporting role, but Turkey is the key. That is the lesson of a recent war game on Syria played out at the Brookings Institution. Geography alone makes Turkey’s role critical, but so too does its credentials as a moderate Islamist state and NATO member. A peacekeeping force should be primarily but not exclusively Muslim in composition. Saudi Arabia, the United Arab Emirates, and Qatar should pay for it. If Russia and China refuse to support it at the United Nations, then the Arab League should be the sponsor.

President Obama has been cautious in responding to the Syrian civil war for the last 18 months. We can be certain that extensive contingency planning and consultations with allies have been underway for the next stages in this crisis. Now we will see how Obama manages an ugly and dangerous challenge in the most volatile place in the world.