Last Sunday, Turkey’s ruling party, AKP, lost its majority after more than a decade in power— likely sounding the death knell of President Recep Tayyip Erdogan’s ambitions to usher Turkey toward a presidential system and establish himself as the undisputed leader.

Erdogan and his party have long been a lightning rod. The Guardian described Sunday’s elections as Erdogan’s “one-man drive to rewrite the constitution, abolish parliamentarianism and install a quasi-dictatorship.” Yet few expected Erdogan and his party to be humbled in the way it was. AKP, which had 326 of the 550 seats in the parliament and was actually aiming for closer to 400, ended up receiving only 256 seats—seventy less than its original count, and twenty short of the 276 seats required to form a one-party government.

The post-mortems have knocked Erdogan for a long list of political missteps: his transition from reformist democrat to conservative autocrat, his break with Fethullah Gulen, an elusive cleric whose Hizmet movement remains a major political force, the swirling graft allegations, an upswell of popular discontent, and his prominently campaigning for AKP,  even though he was constitutionally required to remain above the political fray. Most of these are faults that have long been part of Erdogan’s identity, but just last year, Erdogan ascended to the presidency from the prime ministership without much trouble and his party saw overwhelming victory in local elections. What changed?

A single phrase explains Sunday’s elections: What goes around, comes around. The reason behind AKP’s demise is the very reason behind its meteoric rise in 2002: the structure of Turkey’s parliamentary system. Turkey uses the “d’Hondt method with a barrier,” a notoriously complicated form of party-list proportional representation. The d’Hondt method makes it easier to form fairly stable governments, as it neither favors the top scorer, nor gives minority parties disproportionate bargaining power. Its fault, however, is that it favors larger, national parties against small, regionally based parties, who usually fall short of the electoral threshold (10 percent of the popular vote) for entering parliament. Under Turkey’s system, a party is currently required to get more 4.6 million votes to enter the parliament; leading most voters to prefer larger parties for the smaller ones worrying that their votes would be wasted.

For Turkey, the system traditionally had the dual benefits of preventing a fragmented parliament and locking the Kurds out of the political system. At the same time, it permitted the anomaly that was AKP’s overwhelming victory in 2002. Although it received only around 34 percent of the overall vote that year, AKP controlled 66 percent of the parliament with 363 seats, just three seats shy of the two-thirds parliamentary majority required to rewrite the constitution. Largely this occurred because 46 percent of the votes were cast for parties that failed to clear the threshold. Two center-right parties, the market-liberal DYP and the nationalist MHP, only fell short by about 1 percent of the vote. If they had earned just a few more votes, the Erdogan saga would have ended before it even started.

In an ironic twist, the same structure that won AKP its victory in 2002 also brought its defeat in 2015; despite receiving 41 percent of the vote, AKP failed to reach a parliamentary majority, since the Kurds cleared the 10 percent threshold, becoming the fourth party in the parliament. The Kurdish People’s Democratic Party (HDP) earned 81 seats; the main opposition party, the social-democratic Republican People’s Party (CHP) won 131; MHP won 79; and AKP holds the remaining 259.

With Sunday’s elections, the Kurds reaped the reward of their slow but steady path to carving their own political space. In 1991, five Kurdish activists made history getting elected to the parliament on the ticket of the social democratic party, SHP, which later merged with the CHP. When they attempted to take their oath in Kurdish, it sparked a national uproar and led them to spending more than ten years in imprisonment.

Since then, despite the electoral threshold and having four of their political parties dissolved in 1993, 1994, 2003 and 2007, the Kurds cautiously expanded their power over local, and then national, politics. They tread a careful path lest history would recur—embracing a broader left-wing agenda over ethnic nationalism, joining forces with an assortment of smaller, left-aligned parties, nominating well-respected leftist intellectuals and activists alongside Kurdish political veterans, and fielding their candidates as independents.

Sunday’s elections marked an important milestone in the trajectory of the Kurdish political movement; sealing its choice to become a left-wing party with a national base instead of confining itself to an ethnic nationalism in a narrow geographic space. As such, it had expected to become a kingmaker  in national politics–not unlike Germany’s Die Linke. So far, the wager is paying off.

HDP’s success also owes much to two names—Kemal Kilicdaroglu, the main opposition party leader of CHP, and Selahattin Demirtas, HDP’s own leader. Kilicdaroglu risked his own political fortune by desisting from attacking HDP despite the outflow of around 5 percent of the overall vote from his own party to the HDP. Demirtas, a human rights lawyer, won a devout following among urban left-leaning voters consisting of mostly youth and women. With his charisma and generational appeal, Demirtas has been compared to Europe’s rising left-populists, like Greece’s Alexis Tsipras and Spain’s Pablo Iglesias. He stands in stark contrast to the other older opposition leaders: MHP’s Devlet Bahceli is a gaffe-prone septuagenarian who has been leading his party for almost two decades, while CHP’s Kemal Kilicdaroglu is as exciting as any other retired actuary.

While Demirtas’s popstar charms may have won him an election, they won’t solve his many problems. The Kurdistan Worker’s Party (PKK), which is on the U.S. State Department’s Foreign Terrorist Organizations list for its bloody campaign against the Turkish government, maintains a strong influence on Kurdish politics. Like the Kurds themselves, the PKK’s politics are fairly conservative. In an interview last year, PKK leader Cemil Bayik bemoaned that HDP is pandering to “Cihangir marginalism,” using Istanbul’s upscale Cihangir neighborhood as a metonym in a thinly veiled jab against HDP’s cosmopolitan-left elements and its influence on issues like LGBT rights. PKK’s founder,  Abdullah Ocalan, has been in solitary confinement at an island prison since his capture in 2003, but he remains influential over the Kurds.

For the broader public, however, his name is still toxic—when Demirtas thanked Ocalan in his victory speech, it unleashed a torrent of angry comments on social media. The Ocalan factor—essentially, hesitancy about supporting a Kurdish party in general—is already giving momentum to MHP, which still considers HDP an extension of the PKK and has therefore been reluctant to negotiate with the Kurds. MHP increased its voteshare by about 25 percent this time around. Unless Demirtas can convince his non-Kurd voters that he will keep a healthy distance from Ocalan, HDP’s victory could be a one-time feat, and could even enable MHP’s rise or  pull AKP and MHP closer together, in their opposition to the HDP. But it’s not so simple for Demirtas, for whom distance from Ocalan risks alienating the Kurdish base and angering the party’s Kurdish activists, most of whom continue to regard Ocalan as their natural leader.

Sunday’s elections left many questions unanswered, and as the government struggles to form a coalition—or perhaps even turns to early elections—bystanders and Turkish citizens alike will wonder what will become of Turkish policies and politics. But what we do know is that Turkey’s antiquated electoral system is unraveling. There is no doubt that Turkey’s other small parties, like the conservative-liberal Democratic Party and Islamist-conservative Virtue Party, are watching carefully. If the Kurds could leverage their newfound power to finally bring an end to Turkey’s electoral injustice and get the electoral threshold lowered, or even removed altogether, then the era of large parties might be over—even for the biggest of political giants, like Erdogan.