In this Sept. 18, 2016, photo released by an official website of the office of the Iranian supreme leader, Revolutionary Guard Gen. Qassem Soleimani, center, attends a meeting with Supreme Leader Ayatollah Ali Khamenei and Revolutionary Guard commanders in Tehran, Iran. A U.S. airstrike near Baghdad's airport on Friday killed Soleimani, the head of Iran's elite Quds Force. Soleimani was considered the architect of Iran's policy in Syria. Credit: Courtesy of Office of the Iranian Supreme Leader via AP

Qassem Soleimani was never going to die peacefully in his bed.

As leader of the Quds Force of the Iranian Revolutionary Guard Corps, and puppet-master of militias and terrorist groups across the Middle East, he had the blood of hundreds of thousands on his hands: Syrians, Iraqis, Yemenis, Lebanese, Palestinians, Israelis, Americans and fellow Iranians, among others. His death was hoped for and prayed for by the families of his victims, and plotted by their governments.

It is a measure of Soleimani’s brashness that he nonetheless strutted around Baghdad in the company of other wanted mass killers, whose faces, in another age, would be on “Wanted” posters on the walls of local post offices. It was incautious to the point of suicidal that he should have been doing so in the days after his most brazen stunt: the New Year’s Eve assault by his Iraqi proxies on the U.S. embassy in Baghdad.

Soleimani’s death-by-drone was the predictable denouement of his escalating recklessness over the years. That his top local lackey, Abu Mahdi al-Muhandis, should have perished with him is appropriate.

The Iraqi had been the instrument of Soleimani’s decision to step up rocket attacks on U.S. bases, leading to the trigger event of this week’s turmoil: the killing of an American contractor at a base near the northern city of Kirkuk.

This escalation in deed matched a similar intensification in word by Soleimani’s boss, Supreme Leader Ali Khamenei, who goaded President Donald Trump in the manner guaranteed to get his goat: by taunting him on Twitter.

“You can’t do anything,” Khamenei tweeted, after Trump blamed Iran for the embassy attack.

Khamenei and Soleimani seem to have calculated that Trump would respond to their provocations just as the leaders of Saudi Arabia and the United Arab Emirates have to progressively brazen attacks on their shipping and oil installations.

Perhaps they thought he couldn’t risk a war, or a crisis that would send oil prices spiking, in an election year. Or perhaps they thought he simply didn’t have the stomach for a confrontation.

Whatever their reasoning, playing chicken with the American president was a hideous mistake. Contrary to Khamenei’s taunt, Trump could do many things, ranging from tightening the economic sanctions that have already cost Iran dearly, to striking Iran’s proxies, as with last Sunday’s bombing of Muhandis’ Kataieb Hezbollah. These may have been acceptable outcomes for Khamenei: After all, a man who only weeks ago ordered the slaughter of hundreds of Iranians is unlikely to balk at causing more pain to his own people or proxies.

But Khamenei failed to reckon with Trump’s capacity for recklessness. Rather than merely ratchet up sanctions, the president chose to order a drone attack that brought a fiery end to the life and career of one of Iran’s most fearsome and important military commanders.

What now? The cycle of recklessness that the supreme leader began leaves him little option except to keep raising the stakes. But he must now do so without his most effective instrument of terror, a commander distinguished for his unquestioned obedience and apparently inexhaustible appetite for violence. Those are qualities Khamenei will surely miss amid the mayhem he has unleashed.

Bobby Ghosh is a columnist and member of the Bloomberg Opinion editorial board. He writes on foreign affairs, with a special focus on the Middle East and the wider Islamic world.