People wave Turkish flags in Istanbul on Monday as they wait for President Recep Tayyip Erdogan during a rally to honor the victims of the failed coup of July 15, 2016. (Lefteris Pitarakis/AP)

Turkey’s ruling Justice and Development Party, or AKP, recently lost elections for control of Istanbul and Ankara, Turkey’s largest cities. But the defection of several high-profile party leaders could hurt President Recep Tayyip Erdogan even more.

In April, former prime minister and AKP leader Ahmet Davutoglu issued a written statement, posted on his Facebook page, openly breaking with the AKP and signaling that he would form a new party. Then, in early July, Ali Babacan, Turkey’s former economy czar, also quit the AKP — and similarly announced that he would form a rival party. Babacan is influential in the business community and is backed by former president Abdullah Gul. Babacan claims he already has the backing of several high-profile figures, and observers claim that more defectors are waiting in the wings.

Why is this a big deal?

Arguably the most significant threat that autocrats face comes not from the masses but from their elite allies. When such allies defect, the regime loses the skills, followers and resources that they command. High-level defectors often help rally the masses against the regime. If they run for office, they can peel away the regime’s voters.

Defections also signal that the regime is weakening, which can embolden challengers. Over the past 20 years, elite defections have contributed to the breakdown of autocracies all over the world, in places such as Malaysia, Kenya, Nigeria, Ukraine, Serbia and Georgia.

These defections damage Erdogan’s hold on power. As economy czar, Babacan presided over an economic boom between 2009 and 2015, earning a reputation as an effective manager. A recent poll found that his new party could win as much as 17 percent of the vote, drawing most of that from AKP supporters.

Former prime minister Davutoglu is a skilled political operator who styles himself as a reformist alternative to Erdogan. He has recently been courting support among the religiously conservative voters who form the AKP’s base.

Combined with the party’s losses in Istanbul and Ankara, these splits create the perception that the AKP is vulnerable.

Why now?

In recent years, political science has learned a lot about why such defections happen. Personal and policy differences clearly matter, but disagreements are widespread in politics; large-scale defections are not. Recent research has identified the conditions that make defections more likely.

First, studies show economic recessions make defections more likely. A weakening economy gives a dissenter a reason to criticize the regime and makes it more likely that potential defectors will find support outside the party. In Turkey, Davutoglu and Babacan have explicitly cited economic decline in their criticisms of the AKP.

Second, when the regime starts to lose voter support, elites are more likely to defect. It’s no coincidence that these defections follow the AKP’s losses in Istanbul and Ankara.

Creeping “personalism,” a term political scientists use to describe unconstrained rule by a single leader, can also cause defections. One of the ways that autocrats keep subordinates loyal is by sharing the spoils of office — delivering things like corruption kickbacks, plum jobs and promotions. Ambitious elites prefer it when these spoils are handed out in a predictable manner, governed by rules. When dictators start arbitrarily distributing spoils to cronies, family members and upstart outsiders, the elite establishment can become disgruntled. Scholars argue that institutionalized, party-based regimes such as China’s are less likely to suffer elite schisms. Recent research shows that defections are more likely in personalist regimes.

Turkey is a case in point. AKP stalwarts have bristled in recent years as Erdogan has consolidated his personal control over the party. A year ago, Erdogan used newly acquired presidential powers to appoint his 40-year-old son-in-law as economy czar, passing over several more senior candidates. In June, Davutoglu criticized Erdogan for such personalist moves, saying: “The AKP is not the party of one person, one family or one group alone. State structure and family ties must absolutely be separated. There must be no first-degree relatives.”

Political science has a hard time predicting exactly who will defect but can discern certain patterns. One consistent finding is that elites with ties to private business have an easier time making it on their own. When elites have financial resources that are autonomous from the state, they are more likely to defect. This helps explain why Babacan is jumping ship. A former textile magnate, Babacan has strong ties to the business community and is expected to draw financial support from conservative business leaders who have traditionally backed the AKP.

Elite defections are particularly dangerous for the regime when they begin to build on one another. One prominent defection decreases the perceived cost of defection for other elites, who then defect and spur further defections. Such spirals can accelerate still further if they are accompanied by economic downturn, scandals and electoral defeats. The AKP has yet to enter such a spiral, but it could come soon as Turkey’s economy slides into another recession this year.

Don’t miss anything! Sign up to get TMC’s smart analysis in your inbox, three days a week.

Yunus Orhan is a PhD student in the political science department at the University of Wisconsin at Milwaukee.

Ora John Reuter is an associate professor of political science at the University of Wisconsin at Milwaukee and the author of “The Origins of Dominant Parties: Building Authoritarian Institutions in Post-Soviet Russia” (Cambridge University Press, 2017).