If there is a lesson to be drawn from the Nov. 1 Turkish elections, it is that fear works, and there are few people better at engendering it than Turkish President Recep Tayyip Erdogan. Only five months after the Justice and Development Party (AKP) lost its majority in the Turkish parliament, a snap election put it back in the driver’s seat.

The cost of the victory, however, may be dear, because, to achieve it, Erdogan reignited Turkey’s long and bloody war with the Kurds, stood silent while mobs of nationalists attacked his opponents, and unilaterally altered the constitutional role of his office.

Observers from the Council of Europe and the Organization for Security and Cooperation in Europe said that violence and attacks on the media had a significant impact on the election. “Unfortunately we come to the conclusion that this campaign was unfair, and was characterized by too much violence and fear,” said Andreas Gross, a Swiss parliamentarian and head of the Parliamentary Assembly of the Council of Europe delegation,

At the same time the European Union (EU) seemed to favor an AKP victory. The EU Commission held off a report critical of Turkish democracy until after the vote. Two weeks before the election German Chancellor Angela Merkel visited Turkey bearing $3.3 billion in aid for Syrian refugees and an offer for Turkey to revive its efforts to get into the EU. Previously, Merkel had been opposed to Turkish membership in the EU.

The finally tally is almost everything Erdogan wanted, although he fell short of his dream of a supermajority that would let him change the nature of the Turkish political system from a parliamentary government to one ruled by a powerful and centralized executive—himself.

There are 550 seats in the Turkish parliament. The AKP took 49.4 percent of the vote and won 317 seats, an increase of 64 over the June election. While 276 seats is a majority, what Erdogan wanted was a supermajority of 367 seats that would allow him to change the constitution without involving the electorate. He did not achieve this.

The secular Republican People’s Party (CHP) picked up two seats over the June election for a total of 134 seats. The Kurdish-dominated leftwing People’s Democratic Party (HDP), which scored an historic 13.1 percent of the vote and 80 seats in the June election, managed to squeak by with 10.7% of the vote and 61 seats. If it had failed to pass the 10 Percent barrier for parliamentary representation, most of those seats would have gone to the AKP, possibly giving Erdogan’s party the supermajority it craved.

Indeed, it was a statement of the HDP’s resilience that despite the violence directed at the party and the arrest of many HDP activists, the organizations still managed to clear the 10 percent bar for representation in the parliament. The HDP announced that it planned to challenge several seats that the party says involved fraud.

The rightwing Nationalist Action Party (HDP) dropped 31 seats, falling to fourth place with only 40 seats. It would appear that most of their voters jumped to the AKP.

Erdogan set out to change the Turkish constitution back in 2007 and has pushed to reconstruct the country’s politics ever since. However, the AKP has never had 330 votes in the parliament, the number needed to place a referendum before the voters. Erdogan did not get that magic number this time either, but he is close and may be able to pry a dozen or so voters from the ranks of the rightwing nationalists and get his referendum.

The AKP won almost five million more votes than it did last June. Voter turnout was over 86 percent.

A referendum is a disquieting thought. Erdogan is a relentless campaigner, and opponents are worried that, while most Turks do not show much enthusiasm for his constitutional changes, scare tactics, repression, and money will push such a referendum through. Pre-election polls predicted that the AKP would get about the same number of votes in November that it got in June. They were dead wrong. Erdogan’s formidable political skills and his willingness to polarize the country are not to be underestimated.

While the AKP now has a majority, it is at the expense of re-igniting the war with the Kurds, a conflict that has cost Turkey $1.2 trillion and some 40,000 lives. It has also seen an almost unprecedented wave of attacks on the Kurdish party, its supporters, and the press.

Four days before the Nov. 1 election, police raided the offices of Ipek Media, closing down two newspapers and two TV stations. The news outlets have been handed over to a government trustee who is investigating them for “supporting terrorism.” Ipek Media is closely associated with Fethullah Gulen, an Islamic preacher currently living in exile in the U.S. Gulen and Erdogan were formerly allies, but had a falling out in 2012.

Erdogan has also gone after several other media outlets, including the Dogan Group, which owns Turkey’ popular daily, Hurriyet, and CNNTurk. Both outlets have interviewed politicians from the HDP, which the President charges is a front for the Kurdish Workers Party (PKK). The PKK is designated a terrorist organization and the target of Turkey’s current war on the Kurds.

While there is a relationship between the PKK and the HDP, the latter has sharply condemned the violence of the former and has a far broader base among Kurds and non-Kurds. Apparently some of the conservative religious Kurds, who voted for the HDP in June, were spooked by the violence and returned to the AKP.

Mobs led by the Ottoman Hearths—the youth arm of the AKP—and the Idealist Hearth—youth arm of the rightwing MHP—have burned HDP offices, attacked Kurdish businesses and homes, and attacked leftwing book stores. On Sept. 8 a nationalist mob rioted for seven hours, burning offices and stores in the city of Kirsehir, while police stood by and watched.

The chair of a local branch of the HDP, Demet Resuloglu, said she warned police about the mob, but they did nothing. She and several others were temporarily trapped in a bookstore by a mob that set the establishment on fire. “We escaped with our lives after jumping from the second floor. It was an organized affair. Everything happened with the knowledge of the police, the governor and everybody,” she told the news outlet Al-Monitor.

Similar attacks took place in the resort towns of Alanya and Manargat.

During the election campaign, Turkish Kurds and leftists were the targets of several bombings that took over 130 lives and were almost certainly the work of the Islamic State. But Erdogan and his prime minister, Ahmet Davutoglu, blamed it on the PKK and tried to tar the HDP with the same brush.

Selahattin Demirtas, a leader of the HDP and a member of parliament, is currently being investigated for supporting “terrorism” and insulting the president, Since Erdogan became president in August of last year, more than 240 people have been charged with insulting him.

Erdogan is likely to treat the AKP’s victory as endorsement of his campaign to overthrow Syrian President Bashar al-Assad, even though polls show that 63 percent of Turks disapprove of getting involved in Syria.

The war has turned into a disastrous quagmire, and the Europeans and the Russians are pushing for a political settlement. Erdogan—a man with a stubborn streak—will probably insist that Assad first must go, a formula that will endear him to the Gulf monarchies, but will almost certainly keep the war going. Turkey is already hosting 2 million Syrian refugees and millions more are headed toward Europe.

The Turkish president has unilaterally redefined the office of the president from one of neutrality to partisan activist. Rather than trying to form a coalition government after last June’s election—a major part of the president’s job—Erdogan sabotaged every effort to compromise, banking he could stir up the furies of sectarianism and fear to create the climate for a comeback. While the AKP is wealthy, parties like the HDP were tapped out by the June election and could not marshal the resources for another national campaign. In the last weeks of the election the HDP canceled rallies, fearing they would be attacked by rightwing mobs or create targets for Islamic State bombers.

Erdogan created chaos and then told voters the AKP was the only path to peace and stability. It was an argument a lot of voters bought, but the costs are high. The press has been muzzled, a war that was over has been re-started, and Turks and Kurds are once more at each other’s throats. The war in Syria is likely to drag on, and the polarization of Turkish society will deepen.

But the AKP has only a slim majority, and the peace and stability it promises is an illusion. As the British Guardian noted, “President Erdogan has got his majority back, but Turkey has been damaged in the process…Sadly, this election is unlikely to mark a passage into calm waters for Turkey.”