What does it take to overthrow a dictator? Reflecting on this question in exile, Leon Trotsky wrote in History of the Russian Revolution (1930):

There is no doubt that the fate of every revolution at a certain point is decided by a break in the disposition of the army … Thus in the streets and squares, by the bridges, at the barrack gates, is waged a ceaseless struggle – now dramatic, now unnoticeable – but always a desperate struggle, for the heart of the soldier.

However solitary the power of an authoritarian leader might seem, dictators never rule alone. When enforcers shirk duty or rebel, the regime collapses. When they stay loyal, the regime stands. Mass protests alone are never enough.

During the Tunisian revolution, the mutiny that ultimately led to the president Zine el Abidine Ben Ali’s flight from power on 14 January 2011 started in an elite police unit exceptionally deployed to protect the Ministry of Interior against the biggest demonstration to date. When protesters marched on to the presidential palace, disobedience spread to the other security forces, and Ben Ali was forced to flee hours later. When police turned, the regime fell.

But why military and police forces decide to follow one course of action over another is poorly understood. Prevailing explanations of military defection during revolutionary uprisings emphasise personal or corporate interests. In this logic, grievances spur to action rebel officers, who hope for a better deal in a new political system. Loyalists, for their part, seek to preserve their material advantages.

Behind this hard-nosed Hobbesian realism, the argument rests on a simple, commonsense account: people do what is most advantageous to them. The claim is appealing when made from a distance and with the benefit of hindsight. But it struggles to explain why men who have dedicated their career to the service of a government and who have forged their professional identity on a bedrock of discipline would come to turn around and commit insubordination. The argument gives us no account of how members of the armed and security forces come to change their understanding of their interests when facing a mass unrest.

The decision to rebel is a far cry from the execution of obvious and well-understood material interests. It is also easy to overlook how profound an ethical dilemma mass repression can pose to professional soldiers and policemen. Consider a country in the midst of a full-scale uprising. Tens or hundreds of thousands of demonstrators fill the streets of its capital city. The authoritarian ruler can no longer rely on his secret police and riot-response units. He must mobilise reserve forces, who typically carry live ammunition and have no training or experience in dealing with crowds. These men face a stark choice. Defending the regime comes at the price of massive bloodshed. Shirking duty or rebelling carry the threat of court martial and death.

Even for those with experience in repression, being made to kill tens or hundreds of innocents is often a deeply unpleasant prospect. The dilemma is first ethical and individual: it betrays a stark choice between serving one’s government and serving one’s country. But it quickly becomes collective. When an officer becomes aware that he’s not alone in his conundrum, he begins to wonder whether his colleagues will follow orders. From this doubt emerges the possibility of his own disobedience.

Military and police mutinies rarely break out in the face of small demonstrations, but reliably occur when revolutionary uprisings reach a critical mass, making unconscionable largescale killing the government’s only survival option. This year, scattered protesters in Sudan defied security forces for more than three months without prompting largescale defections; but when the opposition converged in a sit-in in front of the military’s headquarters on 6 April, soldiers wavered. On the second day, they protected demonstrators against loyalist militias. And on 12 April, the military and security apparatus turned against the president Omar al-Bashir.

Rebellions that begin during uprisings often spread like wildfire throughout the military and security apparatus. The Russian revolution of 1917 began when the Volynsky Life-Guards Regiment ‘refused to serve as executioners any longer’, as the Soviet historian E N Burdzhalov put it in 1967; the mutiny then propagated rapidly to neighbouring regiments in Petrograd. Burdzhalov writes that, by the evening, ‘no tsarist general could have taken charge of the situation to save the autocracy’.

It would be a mistake, however, to read these dynamics primarily as symptoms of widespread, longstanding grievances within the armed and security forces. They owe more, instead, to officers’ attempts to align themselves with one another. Once a mutiny begins, the threat of fratricidal violence between loyalists and rebels weighs heavily over officers’ calculations. Would-be loyalists will often go along with a mutiny to avoid infighting. In Tunisia, the head of the rebellion against Ben Ali rallied two additional units by pretending to act on orders; when his colleagues understood that he had lied, they remained on his side instead of turning their weapons against him. Minutes later, Ben Ali’s head of security, a loyalist, convinced the president to board a plane to Saudi Arabia, saying he feared ‘a bloodbath’.

In other cases, potential rebels will abstain from joining a mutiny that they think will fail. In China, troops fraternised with demonstrators on Tiananmen Square in 1989, while officers publicly condemned the government’s decision to declare martial law. Despite this vacillation, no officer took the initiative to mount an open rebellion. The government reasserted the initiative and decisively crushed the uprising.

In the language of game theory, such mutinies are coordination games: situations in which individuals seek to follow the same line of conduct at the expense of their own preferences because acting at cross purposes represents the worst possible outcome for everyone. Each must figure out what others will do, which is why expectations – mutual beliefs about what comes next – drive behaviour. Whether mutinies in revolutionary moments succeed or fail owes more to rebels’ ability to create the impression that they will ineluctably succeed than to the pre-existing grievances of their colleagues.

The point has deep epistemological implications for our understanding of revolutionary outcomes. Uprisings often begin in similar ways but take wildly different paths, from political revolutions to authoritarian restoration, civil war and social revolutions. Social scientific analyses of revolutions typically seek to see past the turmoil of events to uncover subterranean patterns of causation linking slow-moving factors – the makeup of social classes, state structure, economic conditions – to different outcomes. But if armed forces make or break revolutions, and if their stance owes to events occurring on the temporal scale of hours or even minutes, then the explanatory value of such ‘structural’ accounts of revolutions loses much of its edge. To explain why countries diverge, we need, instead, to develop better theories regarding the impact of typical revolutionary events, such as mass protests, defections and mutinies.