ANKARA — Selahattin Demirtaş, Turkey’s most prominent Kurdish politician, appeared exhausted when I met him on a recent evening at his party’s headquarters in the capital.

Parliament had just gone into recess and his aides were discussing their holiday plans after some draining weeks. But there was no respite for Demirtaş, leader of the Peoples’ Democratic Party (HDP).

Just a few hours after our conversation, he had to rush off to the southern city of Gaziantep after yet another attack, this one killing 54 guests at a Kurdish wedding, many of them members of his party.

Turkey’s year of terror has exerted a particularly heavy toll on the HDP, until recently considered to be the largest obstacle to President Recep Tayyip Erdoğan’s ambitions for expanded powers. Not only has the party been targeted in several jihadist bombings, it has also lost support from voters for its perceived links to a homegrown militant group.

Last month’s failed coup has further accelerated the party’s decline. The plotters’ defeat bolstered Erdoğan’s ruling Justice and Development Party (AKP) and pushed the HDP to the margins of Turkey’s political sphere.

Meanwhile, Ankara’s recent incursion into Syria spells bad news for the party's core base: Turkey’s Kurds feel close to their Syrian kin, whose fighters now battle Turkish-backed rebels.

Some pollsters estimate that support for the party had fallen to 8 percent. With the threshold set at 10 percent, the HDP could fail to enter parliament if an election is held soon — a stunning reversal of fortunes for a party that only a year ago seemed poised to revitalize Turkish politics.

* * *

Founded in 2012, the party grew from its roots in the Kurdish southeast to include a colorful coalition of liberals across Turkey. Its candidates for the 2015 elections included socialists, environmentalists, feminists and members of the LGBT community — in short, the elements of Turkish society that did not fit into the ruling party’s vision of social and religious conservatism.

A platform of progressive policies earned the HDP the admiration of Western journalists and diplomats. But it was Demirtaş who brought the party into the mainstream.

The youthful Kurdish politician charmed the voters, casting polarizing words aside in favor of direct engagement with voters, jokes at the president’s expense, and — once — playing the saz, a Turkish folk guitar, on television. In a political landscape populated by colorless leaders, Demirtaş alone matched Erdoğan in charisma and rhetoric.

The president wasn't amused.

Erdoğan had long wanted to replace Turkey’s parliamentary system with a presidential one, granting himself more powers, a prospect that alarmed the opposition and the country’s Western allies.

Demirtaş declared that his party would prevent Erdoğan from doing so.

When the HDP surprised everyone by sweeping into parliament with 13 percent of the vote in June, it was an unprecedented feat. No party rooted in the Kurdish movement had ever leaped over the parliamentary threshold, the highest in the democratic world.

At a rapidly convened press conference, Demirtaş and his co-chair, the Turkish socialist Figen Yüksekdağ (all leadership positions in the HDP are held by both a woman and a man) described the result as a victory of “freedom, democracy and peace” as jubilant supporters chanted their names outside.

Amid the celebrations, Demirtaş felt a sense of foreboding. His party’s success had come at the expense of the AKP, which lost its majority for the first time in 13 years, costing Erdoğan his dream of a presidential system. Demirtaş thought the president might seek revenge.

“Unfortunately,” he said, “we were right.”

* * *

The following month, when the militant Kurdistan Workers’ Party (PKK) ended a two-year ceasefire by killing two policemen, the government retaliated hard by bombing the group’s camps in northern Iraq, shattering any hope for an immediate return to talks.

With the country headed towards a second election — the first failed to produce a coalition government — Erdoğan’s message was to offer voters a stark choice: It's me — or chaos.

Erdoğan had read the electorate right: Voters yearned for stability. The lira had hit a record low and the number of soldiers killed in the southeast was steadily rising.

By suggesting that the HDP was the political wing of the PKK, whose three-decade insurgency has killed some 40,000 people, Erdoğan was able to paint the party as a threat to Turkey.

Newspapers and agencies close to the Kurdish nationalist movement have faced lawsuits for creating “propaganda” for the PKK.

“It’s unfair to link us directly with the PKK. It’s a lie. We are not the PKK’s party,” Demirtaş said, anger rising in his voice. “The PKK is an armed people’s movement. We are a democratic, legal, political party.”

But although Demirtaş had worked hard to distance his party from the PKK, there were enough links between them to make Erdoğan’s accusations appear plausible.

After all, it was no secret that many of the party’s core voters sympathized with the guerrillas and that a HDP delegation frequently visited the imprisoned PKK leader Abdullah Öcalan as part of the peace negotiation process — the very same ties that once helped steer Turkey’s “Kurdish problem” towards a political solution.

But the party also found it almost impossible to defend itself effectively in public. Turkey’s national news media is effectively controlled by the state and no government-supporting outfit dared or wanted to give a platform to the HDP.

Newspapers and agencies close to the Kurdish nationalist movement, meanwhile, faced lawsuits for creating “propaganda” for the PKK in what has become an ever-widening crackdown on the media, and in particular Kurdish journalists. Earlier this month, the popular daily Özgür Gündem was shut down and its editors detained.

* * *

As the insurgency flared up again, fueled by the PKK youth wing and the government's merciless response, Erdoğan’s election strategy proved effective: in November, his party regained a parliamentary majority. The HDP scored 10.7 percent, inching past the Nationalist Movement Party to become the third- largest bloc in parliament, albeit diminished.

“There’s extreme tensions within the HDP and the PKK” — Aaron Stein, senior fellow at the Atlantic Council’s Rafik Hariri Center

The party, however, had been irrevocably tainted. Many believed that calls by party leaders for the PKK to stop its attacks were half-hearted and local party officials were accused of complicity in the violence.

Even the party’s Kurdish base felt that the HDP had not done enough to prevent the PKK from moving its war into the cities, said Mehmet Kaya, head of the Tigris Social Research Center based in Diyarbakır, Turkey’s de facto Kurdish capital.

“The HDP were unable to develop a strong stance against the PKK’s violent actions.”

Demirtaş acknowledges that the HDP didn't respond to the violence fast enough.

“We paid the price for the war,” he said.

* * *

Clearly, the party has done itself no favors. The leadership often appears to issue contradictory statements — condemning the PKK’s use of violence but also describing it as a “people’s movement” rather than the terrorist group Turkey and its NATO allies consider it to be.

And there have been spectacular political blunders, drawing criticism even from HDP supporters: In February, an MP attended the funeral of a suicide bomber who had killed 29 people in Ankara, and in May, after a debate on the constitution ended in a brawl in parliament, several members of the party walked out chanting “biji serok Apo” — "long live Abdullah Öcalan."

Finally, the party hasn't been helped by the rift within the Kurdish national movement between those who advocate a political solution and those who support the PKK’s “armed struggle.”

“There’s extreme tensions within the HDP and the PKK,” said Aaron Stein, a senior fellow at the Atlantic Council’s Rafik Hariri Center. “You have Cemil Bayık” — the PKK’s acting leader — “coming out with one thing one day and then you have Demirtaş coming out and saying the complete opposite, condemning attacks.”

The HDP was excluded from the cross-party rallies and new talks on the constitution.

The international praise heaped on the HDP obscures that the party is enormously divisive domestically, said Stein.

“Yes, they got 13 percent of the vote but Turkey is so polarized that I’d bet you that 80 percent don’t like them.”

The renewed insurgency has also dulled Demirtaş’ star. Trapped between competing demands — to condemn the PKK’s violence while remaining faithful to his voter base, which expects him to condemn the state — he now tries to occupy a middle ground that neither side appears to be entirely happy with.

"He was in an impossible position,” Stein said of Demirtaş.

* * *

The July 15 coup attempt was a chance for a reset. When rogue officers tried to overthrow the government, Kurds in the southeast protested in the street alongside Turks from all walks of life.

Although at odds with the state, they had good reason to defend Turkey’s democratically elected government: If history is any guide, the Kurds would have suffered most under a military regime.

“If the coup plotters had been successful, of course, there would have been a strong possibility that we would be arrested and put into prison,” said Demirtaş, before adding dryly: “But even without the coup attempt, Erdoğan was already getting ready to arrest us.”

For a short period after the coup, the otherwise confrontational president mended fences with his rivals and the entire country appeared to come together in a rare moment of political unity.

Erdoğan even met opposition leaders at his palace to thank them for their solidarity during the coup attempt, shaking hands and posing for photographs — an unthinkable image only weeks ago.

Demirtaş wasn’t invited. The HDP was excluded from the cross-party rallies and new talks on the constitution. When Erdoğan announced he would drop all lawsuits against those charged with insulting him, he made it clear that cases against the HDP would continue.

“Erdoğan is practicing politics feeding on tensions and hate,” Demirtaş said.

The HDP doesn’t represent all Kurds — for instance, a survey showed that Kurds made up 12 percent of those who attended the government-led rallies in Istanbul after the coup — but unity without the HDP carries a dangerous symbolism, says Mehmet Kaya from the Tigris Center.

“It is basically seen as the exclusion of the Kurds,” he said.

* * *

Ankara’s recent foray into Syria will likely raise tensions further. Ostensibly an offensive to drive Islamic State from the Turkish border, the operation also targets Syria’s Kurdish militias.

The government fears that if the Syrian Kurds capture more territory, they will eventually form an independent state along Turkey’s border, emboldening their Turkish kin in their own quest for greater autonomy.

While Turkish Kurds who die fighting against ISIL for the Syrian YPG militia receive emotional “martyr” funerals in the southeast, Ankara considers them to be terrorists. Many Kurds, in turn, believe that the Turkish government is in cahoots with ISIL, a suggestion also made by Demirtaş.

The jihadists have skillfully exploited this widening divide, noted Mesut Yeğen, an expert on Kurdish affairs at Istanbul’s Sehir University.

“Instead of attacking, say, Turkish forces, they consciously attack Kurds. They want a growing tension between the Kurds and the Turks.”

The deadliest ISIL bombing on Turkish soil targeted a HDP-led peace rally in Ankara last October, killing more than 100 people.

The PKK, too, is stepping up attacks. A string of major bombings in the southeastern region this month has killed dozens, including civilians. On Friday morning, a car bomb in Cizre — a southeastern town devastated by fighting — killed at least 11 people.

Demirtaş knows that the hostility towards the HDP will grow as long as the insurgency lasts and both parties are reluctant to return to talks. Still, he remains hopeful that his party will endure.

“The HDP is a bright party. It is a light in the darkness of the Middle East,” he said. “Maybe not in the short term. But in the long term, parties like ours will determine the future of both Turkey and the Middle East. I have faith in this.”

Zia Weise is a freelance journalist based in Istanbul.