In the autumn of 1990, six years into the Kurdistan Workers party’s (PKK) insurgency against the Turkish state, a political activist named Vedat Aydin rose to his feet to address a human rights conference in the capital, Ankara. When Aydin began to speak, it was not in Turkish, the official language of the state, but Kurmanji, a Kurdish dialect that had for decades been effectively banned in public places. The result of this gesture was pandemonium. The moderator of the conference demanded that Aydin switch to Turkish; a fellow Kurd came mischievously onto the platform to translate. Around half those present walked out, and Aydin was detained by police and briefly jailed.

Eight months later Aydin was arrested again, back home in the city of Diyarbakir, in what is effectively the capital of Turkish Kurdistan. Two days after that, his mutilated body was discovered in the countryside outside the city.

Turkish security forces perpetrated thousands of extra-judicial executions of Kurdish activists in the 1990s – along with village clearances and torture on a massive scale – but few provoked the anger of ordinary Kurds more than the killing of the man who had achieved notoriety by standing up to the linguistic proscriptions of the state. On 5 July, 1991, the day of Aydin’s funeral, they came out in their tens of thousands in Diyarbakir.

Among the mourners that day was an 18-year-old local boy called Selahattin Demirtaş, the second son of a plumber and his wife who had given their seven children as stable an upbringing as they could manage in the dirt-poor regional capital.

To Tahir and Sadiye Demirtaş this had meant acquiescing to the official claim that all citizens of the country, bar a few tiny minorities, were Turks. It was only from school friends that Selahattin had learned of the existence of the Kurds, a people that had been living on the mountainous intersection of Mesopotamia and Asia Minor long before the first incursions by Turkish nomads in the 11th century. State propaganda and the collusion of his parents had left Demirtaş unsure as to whether he was a Turk or a Kurd. On 5 July all ambiguity was removed.

The first that Demirtaş saw of the violence that day was when he was swept up in a wave of youngsters being chased by plainclothes policemen wielding planks of wood. Later on, as he recalled in an interview last year with a Turkish newspaper, “they opened fire on the crowd from all sides … the wounded couldn’t be treated because if they went to hospital they would be arrested. And despite all this the newspapers depicted the people of Diyarbakir as responsible for what happened!”

According to the government, eight people were killed that day. Kurdish sources put the figure at more than 20. For Demirtaş, the Diyarbakir killings were an epiphany of the kind that hundreds of thousands of Kurds have experienced over the past 40 years – generally in response to a government atrocity. Such incidents have secured continuous support for the PKK’s war against the Turkish state. “That day,” Demirtaş has said, “I became a different person. My life’s course changed … although I didn’t fully understand the reason behind the events, now I knew: we were Kurds, and since this wasn’t an identity I would toss away, this was also my problem.”

A quarter of a century later, Demirtaş is the embodiment of the Kurds’ political aspirations in Turkey. He is also the exponent of an inclusive politics that is startlingly new, and that owes much to the liberal traditions of the west – so much, in fact, that an admiring ambassador in Ankara recently described him to me as “the only Turkish politician that would not be out of place in a European capital”. But Demirtaş is also the civilian adjunct of a brutal armed movement, caught between bomb and ballot box – a man in the middle.

Since 1984 the PKK, which most western governments consider a terrorist organisation, has been waging an armed insurgency that aimed at first to prise much of southeastern Turkey from the Turks, though autonomy has latterly become the goal. In a conflict that has taken more than 40,000 lives, destroying communities and families from central Anatolia to the Armenian border, Demirtaş is advocate-in-chief for the peaceful solution that many on the government side – and some on his own – demonstrably do not want. And those Kurdish sceptics of peace may include his own elder brother, Nurettin, who served 12 years in a Turkish jail for membership of the PKK’s youth wing and is now believed to be fighting somewhere in Syria or Iraq. (Demirtaş professes ignorance of his brother’s precise whereabouts.)

Demirtaş is more than simply a Kurdish nationalist. He is pushing for a wider liberalisation of the country

In 2014, Demirtaş helped found the Peoples’ Democratic party (HDP), the latest in a long line of Kurdish nationalist parties – with the crucial difference that this one has become a major player on the national stage. In the general election of this June, the HDP became the first such party to surpass the 10% threshold required for parliamentary representation. The HDP’s 13% of the vote secured it 80 seats out of 550 in the Ankara parliament, and prompted the country’s president, Recep Tayyip Erdoğan, to insist on a rerun that is to be held on 1 November.

One of the reasons why Demirtaş has caused Erdoğan much anxiety is that he is more than simply a Kurdish nationalist. He is pushing for a wider liberalisation of the country that would change conditions for all Turkish citizens, empowering minorities and ending the monolithic “national” identity on which Erdoğan and his Justice and Development party (AKP), have built 13 years of electoral success.

Narendra Modi and even Vladimir Putin would recognise Erdoğan’s majoritarian tactics – if not its religious and ethnic nuances. Erdogan’s belief is that Turkey is made up overwhelmingly of ethnic Turks who are also pious Sunni Muslims; Demirtaş has identified all those who do not fit in as his natural constituency. Nothing less than the future of Erdoğan and his conception of Turkey are up for consideration when more than 50 million voters go to the polls, and Selahattin Demirtaş is a big reason why.

Earlier this month, I spent a day following Demirtaş around Istanbul, where his constituency lies. A few days before, dozens of his HDP colleagues and supporters had been blown to pieces in a double suicide bombing, apparently carried out by Isis, as they attended a peace march in Ankara. The death toll was 102, making it the worst terrorist outrage in Turkish history. The bombings had clearly been designed to throw the election into chaos – Demirtaş accused the state of collusion – but no one was sure exactly what their effects would be.

Protesters clash with Turkish riot police during a demonstration against the bomb attacks in Ankara. Photograph: Yasin Akgul/AFP/Getty Images

Demirtaş cancelled all party rallies and interviews with the foreign press, mine included. The rest of the campaign would be fought in mourning and a heightened atmosphere of fear and insecurity.

In person, Demirtaş looks younger than his 43 years, with hardly a wrinkle and a full head of black hair, but his smile is older, slower, and impressed with pain. Because it exhibits none of the cynicism one associates with politicians’ smiles, it is peculiarly powerful, emanating from expressive dark eyes, then spreading over a handsome, wide-open face.

Again in contrast with many politicians in Turkey, Demirtaş does not shout or fulminate when delivering speeches. And he impresses even his opponents with his intelligence. A friend of mine who had been an adviser to Kemal Kılıçdaroğlu, the leader of the main opposition party, described the aftermath of the first meeting between the two men. “When Kemal came out of the meeting,” my friend related, “he looked astonished. He said, ‘Phew! that man’s sharp!’’’

On the day I spent with him, Demirtaş arrived at his first meeting in the official Mercedes Benz that it is his privilege as a party leader to use. When getting out of the car he buttoned the jacket of his blue suit fastidiously, before shaking the hands of wellwishers. Taking his seat at a table inside, nodding at the welcome of his hosts, an association of Shia Muslims, he unbuttoned his jacket again. It’s a way of protecting his good suit – as he himself jokes, his campaign is penniless – but there may also be an element of vanity.

That afternoon we went to a meeting of a cultural centre in the middle of town. Some policemen saw the crowd that had gathered around Demirtaş and made this an excuse for a fracas, with the police pushing the Kurds and the Kurds pushing back. “How rude!” one of the women exclaimed at some obscenity she had heard from one of the policemen.

The meeting room was packed with about 150 supporters. The head of the cultural centre had trouble controlling his breathing as he tried to introduce himself and his colleagues. “I’m excited,” he managed to say. “I am too,” Demirtaş replied. There was a ripple of sympathetic laughter and everyone relaxed.

Demirtaş said a few words. He was building, he said, a “union of the crushed”, which would not simply incorporate the Kurds, but others who have been excluded. A middle-aged woman with short blonde hair indicated she wanted to speak. She introduced herself as a teacher in Sariyer, a wealthy suburb. She was of the generation of Turks that had been brought up to despise the twin menaces of Kurdish nationalism and political Islam – the sort of person who until quite recently would not have contemplated talking congenially with a Kurdish nationalist linked to a terrorist organisation.

But 13 years of AKP rule, with their sour fruits of authoritarianism, corruption, and a leader who seems to regard himself as indispensable, have changed things.

“I’ll be voting HDP come November 1,” the woman announced brightly. “And so will a lot of my friends. You’ll be pleasantly surprised by the number of votes you get!”

The warmth of Demirtaş’s response did not suggest that he looked at her as the symbol of a state that had for years put him down, belittled him, denied he existed. Outside the meeting, an admirer told me: “It may take a few years, but you just watch: he’ll rise the same way Erdoğan did.”

It was only an accident of fate that spared Demirtaş from a brief, fizzling glory as a freedom fighter, and led him into politics. As a 19-year-old, he was shamed into joining the guerrillas by the barbed comments of his friends (“How come you’re still studying when everyone else is heading for the hills?”), but his plan was thwarted by the arrest of the PKK contact who was to take him to the rebel camp. “I realised then,” he would recall, “that a political and legal approach would be far more effective than armed struggle.”

Selahattin Demirtaş, gives a speech during the election campaign, in Istanbul. Photograph: Ozan Kose/AFP/Getty Images

The decision not to fight led Demirtaş to concentrate on his studies. He read law at Ankara University, where he must have perfected the efficient Turkish with which he has made his career. In 1998, he qualified and returned to Diyarbakir, opened a legal practice, and began taking on human rights cases. He was known as “Bones” for his tenacity in recovering the bodies of dead PKK militants from the mountainsides where they fell, and returning them in bodybags to their families for burial. This hazardous pursuit tarred him as the ally of terrorists.

He also brokered deals between the PKK and the Turkish military, in one case personally securing the release of a captured Turkish soldier from militant hands. In 2004, he became head of the Diyarbakir branch of the pro-PKK Human Rights Association – the same post Vedat Aydin had held before his murder in 1991.

No matter where Demirtaş’s sympathies lay, no matter how trenchant his criticism of the government’s human rights abuses, his work was above all a day-to-day negotiation with the representatives of the Turkish state: prosecutors and judges, soldiers, secret policemen. Inevitably there was also frequent contact with local PKK commanders.

This is how Demirtaş found himself in the middle, where he remains today – caught on the one hand between the state and the PKK, and on the other, between advocates of violent and non-violent resistance. Although diplomats who meet him in Ankara invariably urge him to distance himself from the PKK, this would weaken his position within Turkish politics, which depends on his relations with all parties.

For all that, “peace” is a word that comes up a lot in his conversation and speeches, along with “solution”. In an allusion to his (as yet, untested) ability to prevail over hawks in the PKK, he recently described his party as the “only force that can bring about the PKK’s disarmament”. It is a big claim for a politician whose constituency includes millions of Kurds who also ardently support the PKK, and for whose leader, Abdullah Öcalan, he expresses unwavering support.

For much of the period that Demirtaş has spent in active politics – he first entered parliament in 2007 as an independent – the conditions necessary for peace have been slowly coming into being. After the PKK leader’s capture in 1999, Öcalan was sentenced to life imprisonment on the island of Imrali, in the Sea of Marmara, saved from the gallows only by pressure from the European Union. Rather than spit defiance, Öcalan immediately renounced his goal of a separate Kurdistan and promised to cooperate with the state.

In 2002 came another big change in the form of the election of Erdoğan’s Islamist-leaning AKP – against the wishes of the secular, militarist establishment, which had insisted that the Kurdish crisis must be solved through force of arms. Since then, the AKP government has shown remarkable staying power, and last year Erdoğan moved out of the prime minister’s residence and up to the presidency. Over the same period the AKP adopted a conciliatory approach to Kurdish nationalism, drastically reducing army brutality and exploring a political accommodation with the PKK, which responded with a series of ceasefires.

In 2013, after talks with the government, Öcalan announced that he was withdrawing his fighters from Turkish territory into the Kurdish region of northern Iraq, saying it was time for “weapons to be silenced and for politics and ideas to speak”.

But the new process is now comatose, buried under the rubble of Erdoğan’s ambition to shape the future of Syria according to Turkish interests. The president’s policy towards the Syrian civil war was to work for Assad’s removal at any price, and he supported several opposition groups to this end. But this policy has failed, while a Syrian Kurdish offshoot of the PKK, the Democratic Union party, or PYD, has taken advantage of the fighting to seize large tracts of northern Syria, where it has set up self-governing Kurdish enclaves, to the intense irritation of Erdoğan and the Turkish military.

Turkey fears that the emergence of a Kurdish-run Rojava, as these self-governing cantons are collectively called, will lead in time to a border-straddling Kurdistan dominated by the PKK. Elements in the state are widely alleged to have secretly armed Isis as a way to prevent this.

Kobani, the Kurdish Stalingrad, after the siege by Isis. The town’s successful defence became a byword for heroism. Photograph: Bulent Kilic/AFP/Getty Images

Erdoğan has withdrawn the hand of reconciliation he once extended to the Kurds. At the end of last year he refused to aid the Kurdish defence of Kobani, a town just across the Syrian border, when it was being pulverised by Isis. Demirtaş reacted with fury to Erdoğan’s refusal to open the border and allow arms across, and he appealed to his supporters to protest – 40 people were killed in battles with the security forces and a Kurdish Islamist group. Under extreme international pressure, Erdoğan eventually opened the border and the course of the battle changed. Hundreds of Kurds were killed and thousands were wounded, but the town remained in Kurdish hands. Kobani was the Kurdish Stalingrad, and its defence became a byword for heroism.

Kobani impressed on the Kurds that Erdoğan could not be trusted and that anti-Kurdish feeling continued to burn brightly in the Turkish state. Arguably, neither side could be trusted – despite the ceasefire of 2013, and the HDP’s success in June’s election on a peace ticket, both the army and the PKK had continued to stockpile, recruit and otherwise prepare for a resumption of the fighting. All that was needed was a spark.

That came on 20 July, when a suicide bomber blew himself up in the border town of Suruç, killing 33 people – most of them Kurds on their way to Kobani to help rebuild the town. In the aftermath of the bombing, Demirtaş said that the attack had been orchestrated by a deep-state organisation run from the presidential palace. Erdoğan brought a suit for libel. The war resumed.

In mid-October I was in the backstreets of Diyarbakir’s old city, where Selahattin Demirtaş flicked walnuts as a child (there was no money for marbles). I stepped around the rubble with my Kurdish guide, and we ducked into doorways to avoid patrols of soldiers that might not welcome a western journalist picking at Turkey’s problems.

These backstreets had become the latest battleground in the struggle between the Kurds and the Turkish state. In August, Kurdish nationalist ward leaders in the old city announced the creation of an autonomous administration that would brook no interference from appointed state bodies. This was one of more than a dozen simultaneous experiments in self-government that were declared across Turkey’s Kurdish-majority southeast.

For the Turkish state, the establishment of these autonomous regions was an unabashed attempt to replicate the cantons of Rojava on Turkish soil. The military responded with operations involving thousands of men. In the old city of Diyarbakir, the 60-odd armed men and boys who defended the territory, digging trenches and piling sandbags, were no match for the army’s armoured cars, rockets and snipers. After two days’ fighting that left several dead – including one pigeon-fancier allegedly shot while scattering seed for his birds – the Kurdish rebels were overrun.

Now the area wears the familiar aspect of the war-ghetto: the shop-fronts smashed in, the streets bereft of men of working age (many are now in jail), and seemingly no administration at all (the ward leaders are also in jail). “See the strength of the Turk,” warns a large graffito left by a Turkish soldier. Stencilled portraits of Öcalan are still visible on the blasted walls.

My Kurdish escort, a member of the ward parliament, bridled when I suggested that the declaration of self-government had been unwise and the state’s reaction foreseeable. Every day, my companion said, the Turks were bombing PKK camps in northern Iraq. They had even desecrated the graves of PKK martyrs. Inside Turkey, the security forces had stripped a female guerrilla, killed her and then shared photographs of her corpse online. (The Turks have announced an investigation into the incident.) Alongside his outrage I sensed the debt that many non-combatants feel they owe the PKK. “Did they take to the hills for nothing?” my guide asked angrily. “Suffer thirst and cold? Everything has a price.”

What this “everything” is became clearer as I wandered around Diyarbakir, a town that has changed since I was last here a decade ago. Back then the town’s Kurdish character was furtive and suppressed. Now, government offices have signs in Kurdish as well as Turkish, a prominent square has been renamed after a rebel leader from the 1920s, and the city is increasingly known by its Kurdish name, Amed. If you buy the scarf of the local football club, you will find that this too has changed its name – from Diyarbakirspor to Amedspor.

A Turkish policeman questions to a Kurdish boy in Diyarbakir. Photograph: Bulent Kilic/AFP/Getty Images

The changes have not only been linguistic, but social and economic. Although poverty remains – many people in the walled old city seem close to destitution – a considerable number of rural Kurds who migrated from their villages have been able to exploit the opportunities that come from living in a big regional centre. Education and hard work have propelled the children of these people into the middle class – they work in offices, live in well-appointed flats and buy quality Turkish brands in the richer fringes of town.

The Demirtaş family is a good example of this upward mobility. Of the six siblings still in Turkey, two are lawyers, two are teachers, one is a graphic designer and another a textile engineer. Demirtaş’s wife Basak – his childhood sweetheart, also from a poor family – is a teacher, and to judge from the glossy portraits that a mass-circulation newspaper printed last year of the couple with their two daughters, there is little to distinguish this handsome, modern, white-toothed family from many around the world.

Although the attempt to create an autonomous enclave had been a failure, I found a new self-confidence among people in Diyarbakir, and much of this derives from the Kurds’ regional successes. To the heartening longevity of the Kurdish regional government in northern Iraq, a de facto state since the first Gulf war, have now been added the establishment of the Rojava cantons in Syria and the epic of Kobani.

My guide went on to tell me that no fewer than 22 members of his family had joined the PKK in recent years. Three of them had fallen at Kobani. But when I asked him what he thought of Selahattin Demirtaş, he could not bring himself to praise him. I interpreted this as the distaste of a man who is surrounded by guns and sacrifice for a man of peace – who dons his keffiyeh to work the crowd but spends most of his time in suit and tie, supping with the Turks in Ankara. It is a sentiment that experts on the Kurdish situation have told me is widespread.

“Individuals are not important,” my guide added, which is another way of saying that only one individual is important to the Kurdish movement – Abdullah Öcalan – and that no one else should get ideas above their station.

Abdullah Öcalan, the head of the PKK, in 1993. He has been imprisoned since 1999. Photograph: Joseph Barrak/AFP/Getty Images

Öcalan is a tyrannical leader whose hold over his followers is hard for outsiders, including myself, to comprehend. The best explanation is probably a negative one. Were it not for the PKK, which Öcalan launched with the murder of two Turkish soldiers in 1984, it is possible that the forced assimilation of the Kurds into mainstream Turkish society would have advanced much further, and the epiphanies of Demirtaş and others may not have happened.

Demirtaş’s relationship with Öcalan is crucial, given Öcalan’s unchallenged position as a kind of “father” of the Kurdish nation. It is also highly ambiguous. Demirtaş is one of a number of Kurdish non-combatants who have been allowed to visit the guerrilla leader at his island prison, and the formation of the HDP as a party promoting democracy for all citizens is said to have been Öcalan’s idea.

Demirtaş insists that Öcalan should be freed and allowed to take his place in the Kurdish political sphere, but that would lead to rivalry between the two men. It would certainly have an impact on the HDP’s attempts to attract non-Kurds – Öcalan’s long association with violence makes him beyond the pale even for liberal Turks. Although he wouldn’t say it, it is probably better for Demirtaş’s political project that Öcalan remain on his island.

Like Selahattin Demirtaş, Recep Tayyip Erdoğan rose in politics as the representative of a downtrodden segment of society, in his case those pious Sunni Turks who had for decades been persecuted by the country’s secular establishment. Like Demirtaş, Erdoğan proclaimed his desire to allow greater freedom and self-expression not just for his own constituency, but for all neglected citizens of the republic – including the Kurds, who in the mid-2000s voted for him in large numbers.

Erdoğan gradually removed the army’s baleful influence over civilian politics, which had manifested itself in no fewer than three coups since 1950. He also opened negotiations to restore diplomatic relations with the old enemy, Armenia, and enacted pro-democracy reforms that were designed to bring Turkey into the European Union. Just as Demirtaş is the current darling of the western ambassadors, so Erdoğan was a decade ago; the ambassadors took it upon themselves to smooth his plebeian edges and refine his worldview.

But at the first sign that his popularity was waning, as his Syria policy began to fail, the pluralist Erdoğan became the majoritarian Erdoğan. He abandoned his pro-democracy projects and began promoting a binding Turkish-Sunni identity that regards minorities such as the Kurds, the Alevis (a quasi Shia community numbering perhaps 13 million people) and indeed any liberal or non-believer as a menace. His view of the Armenians has soured to such an extent that before mentioning them in an interview last year he deployed the Turkish equivalent of “pardon my French”.

The first indication that Demirtaş’s recipe of peace and federalism might present a threat to Erdoğan’s tarnished leadership came in the 2014 presidential election, when Demirtaş, running as the HDP candidate, scored a creditable 10%. The HDP’s 13% in this June’s election ended the AKP’s 13-year absolute majority in parliament and scotched Erdoğan’s ambitions to increase the powers of the presidency. To a standing ovation from his fellow MPs, in May Demirtaş publicly ruled out a deal whereby the HDP would approve enhanced presidential powers for Erdoğan in return for devolution and Kurdish rights. There would, he said, be no “dirty bargaining … we will not allow you to be an executive president.”

For Erdoğan, the threat posed by Demirtaş lies in the almost one million non-Kurdish votes he picked up in July

For Erdoğan, the threat posed by Demirtaş lies less in the almost blanket support he enjoys among Kurdish voters, which is naturally finite, than the almost one million non-Kurdish votes he picked up in June, which could go up. Alevis, as well as members of the country’s Shia, Christian and small regional minorities, have noted the HDP’s pledge to release the country from the monopolistic understanding of the country as a Turkish Sunni nation, and from a president whose appetite for power is clearly undimmed. Then there are the liberals who took part in the brave but ultimately futile demonstrations against Erdoğan in Istanbul two years ago, women attracted to Demirtaş’s message of equality of opportunity and zero tolerance of domestic violence (31 of the party’s MPs are women), and gay people, hitherto neglected by most of the Turkish body politic, but who receive lavish attention in the party programme. Its inclusivity is what marks the HDP out from the earlier Kurdish nationalist parties it has replaced, and while the idea was approved by Öcalan, it is Demirtaş who implemented it.

Together these groups represent a potentially vast reservoir of HDP voters, whose inherent squeamishness about favouring a Kurdish nationalist party Demirtaş hopes in time to surmount.

But to do this he needs peace, and Erdoğan has taken the country in the opposite direction. He clearly believes that a climate of chaos best suits his design of winning back votes for the AKP. Since the Suruç bombing in July, Turkey has been consumed in a fireball of violence that is reminiscent of the war’s zenith in the 1990s. According to Turkey’s Human Rights Association, the death toll for the first nine months of this year was 407 (the overwhelming majority of these deaths came after Suruç), while 3,500 people were arrested. As documented recently by Human Rights Watch, beatings and other abuses are being administered against detainees, a scourge that Turkey appeared to have put behind it a decade ago.

At the same time, the state has been diligently undermining the HDP’s ability to fight an election campaign, with Turkish nationalist mobs torching party offices around the country (the perpetrators are never caught), a de facto embargo observed by much of the media, and dozens of local Kurdish administrators removed from their posts.

Although the PKK returned to its fighting ways after Suruç – its first operation was to plant a car bomb that killed two soldiers – its commanders had clearly not anticipated Erdoğan’s willingness to wage total war in the runup to November’s election. In October, they were spooked into announcing a unilateral ceasefire under which they pledged only to return fire. Since then, however, Turkish soldiers and the PKK have continued to clash, with deaths on both sides. The soldiers’ funerals are given blanket coverage on the news bulletins every night, complete with close-ups of devastated widows and orphans. It all reinforces Erdoğan’s electoral message: sans moi, le deluge.

The recent violence reached new heights with the suicide bombs that ripped through the Ankara peace march of 10 October. The government had taken few measures to protect the marchers; what security personnel were on hand contented themselves with teargassing the survivors. Since then it has emerged that the families of the two men accused of the Ankara bombing (one of whom was the brother of the Suruç bomber) had alerted the authorities to the fact that their relatives had joined Isis. Despite being officially pursued by police, the bombers were able to travel hundreds of kilometres to Ankara before breakfasting in a cafe and going by taxi to the station.

Responding to Demirtaş’s charge that the government had abetted the Ankara bombers, Erdoğan has blamed the carnage on a combination of PKK, Isis and Syrian government agents, a coalition so laughably implausible as to suggest that he wants to humiliate the bereaved. By implicating the PKK, the president also hopes to deny the Kurds the moral high ground before an election that will have a crucial bearing on the country’s future – and his own.

The polls suggest that the HDP vote will hold up in spite of the violence and intimidation, and that the party will clear the 10% threshold required for parliamentary representation. That would mean another hung parliament. If that happens, it is hard to see how Erdoğan – short of mounting a civilian coup – could prevent the formation of a coalition that would signify the end of his unchallenged dominance of public life, and probably revive a peace process between Turkey and the PKK that, for all its imperfections, offers all sides the best chance of a decent future.

At sundown on 20 October, Selahattin Demirtaş was sitting at one end of a crowded meeting hall belonging to one of Istanbul’s associations of Alevis, while his host made a speech in welcome. He stared out at the cameramen and reporters, and behind them at the long tables, at which several hundred Alevis were also seated, preparing to break their fast.

Campaigning before the June election Demirtaş had been full of mischief, needling Erdoğan, making fun of the AKP’s gaffes. In one speech he brought the house down when he introduced his party’s Armenian candidate, Garo Paylan, as “pardon my French”.

In the Alevi association, in this subdued but defiant campaign, Demirtaş looked past the cameras, his gaze static and distant, and seemed not to be there. He had spent much of the previous 10 days travelling around the country, attending the funerals of victims of the Ankara bombing. He repeated his allegations of government involvement in the bombing.

President Erdoğan (second left) at a wreath-laying ceremony at the site of the Ankara bombings. Photograph: Adem Altan/AFP/Getty Images

So many tears, so much anger; in the atmosphere of hatred and recrimination that has descended over Turkey, others in his position might have contemplated retreat from a struggle that will almost inevitably lead to more deaths, including perhaps his own. (Demirtaş has received several death threats). But Demirtaş is now more than another replaceable figure in Turkish politics, and his choices are no longer his alone. “From the day I was elected an MP,” he once remarked, “I don’t recall single day of happiness.”

I had been with Demirtaş on his rounds since the morning, as he went from meeting to meeting, mouthing the same words of defiance, calling on his devastated supporters to stand firm.

Now he rose to address the Alevis. “Don’t succumb to hopelessness,” he said. “Don’t say, ‘Nothing will change.’” But when the smile came, it was heavy with pain and exhaustion.

It was the mourning month of Muharram, when the Alevis fast in memory of the martyred Imam Hussein, grandson of the prophet Muhammad, whom the Alevis and orthodox Shia revere. After his speech Demirtaş moved to a seat at one of the tables to receive his tray of vegetables with a little meat and yoghurt.

Many Sunnis regard the Alevis as infidels and believe that to share their food is to be defiled. It would be unthinkable for an AKP grandee to do such a thing – Erdoğan, for example, has not concealed his contempt for the Alevis in the past.

Demirtaş, like Erdoğan, is a Sunni, but he was there to share the Alevis’ food, and dispel that old prejudice. Eating his beans, listening attentively to the man next to him, smiling for the smartphones, the mission went on.

• Support for this article was provided by the Pulitzer Center on Crisis Reporting.

Follow the Long Read on Twitter at @gdnlongread, or sign up to the long read weekly email here

• This article was corrected on 30 October, 2015. The original stated that the autumn of 1990 was 16 years into the Kurdistan Workers party’s (PKK) insurgency against the Turkish state. It was in fact six years.