The president of the Iraqi Kurdistan Region, Massoud Barzani, has renewed calls for Turkey to release Selahattin Demirtas, the co-leader of the Peoples’ Democratic Party (HDP), and other lawmakers from the pro-Kurdish bloc who are being held on a mind-numbing array of thinly supported terror charges.

Barzani made the appeal during an hour-long meeting Feb. 25 with President Recep Tayyip Erdogan in Istanbul, reported the Iraqi Kurdish Rudaw media organization. Barzani described his talks with Erdogan at the sumptuous Ottoman-era Mabeyn kiosk as “very good.” He said, “We discussed all subjects,” but chose not to elaborate.

Coming ahead of a referendum on expanding the powers of the Turkish presidency due to be held on April 16, the Iraqi Kurdish leader’s visit has sparked speculation that Erdogan hopes a halo effect will win him votes from conservative Kurds.

Barzani’s close ties with Erdogan remain a matter of controversy in Turkey and Iraqi Kurdistan alike. Turkish Kurds who identify with imprisoned Kurdistan Workers Party (PKK) leader Abdullah Ocalan resent Barzani’s cooperation with the Turkish government and there is escalating pressure on the HDP and its sister party, the Democratic Regions Party (DPB), since the breakdown of a two-and-a-half-year cease-fire between the PKK and the state in July 2015.

At least 11 HDP parliamentarians have been in custody since November and the party says 5,741 of its members and supporters have been detained and 1,482 arrested in recent months.

In the past year, 69 DBP mayors, including Gultan Kisanak and Firat Anli, the co-mayors of the Kurds’ unofficial capital of Diyarbakir, were arrested and 50 government administrators appointed to their seats.

At home, Barzani faces criticism over a major energy deal signed with Turkey in 2013 covering oil pipelines and planned gas sales. Opposition Change Movement leaders accuse Barzani’s Kurdistan Democratic Party of profiting from the deal. But the Kurdistan Regional Government recently agreed to have all its accounts, including proceeds from oil sales made via Turkey, externally audited, making it a lot harder for such charges to stick.

Barzani, who is pushing for independence, has to walk a fine line managing relations with Turkey and the Kurdish public opinion.

Turkey, Iraqi Kurdistan’s sole outlet to the West, gave these plans a big boost when it allowed the Iraqi Kurds to export their oil independently of Baghdad via the Mediterranean port of Ceyhan in May 2014. Barzani also sees the presence of several thousand Turkish troops, including near Mosul, as protection against Shiite militias and Iran, which is stiffly opposed to Kurdish statehood.

Even so, Barzani has deftly managed to cultivate Ankara without bowing to pressure to fight the PKK as he did during the 1990s, when the Turkish army was dictating Turkish policy from behind the scenes. Instead he helped broker the first-ever direct peace talks between Turkey and the PKK in 2009, but these and subsequent stabs at a deal came to naught.

Barzani’s meeting with Ahmet Turk, the DBP mayor of Mardin who was recently released from prison and is seen as the doyen of Kurdish politics in Turkey, sparked fresh rumors that a new round of talks might be in the works.

The pro-government Turkish media has been hinting for some time that when endowed with full executive powers, Erdogan will reach out the Kurds again and Barzani may play a part.

Speaking to reporters after his meeting with Barzani, Turk declared, “President Massoud Barzani is an important actor for the Kurds. President Barzani is a leader of the Kurds and I believe he will do his utmost for the [Kurdish] peace process.”

But relations between Barzani and the PKK have gotten trickier since the PKK moved into the mainly Yazidi area of Sinjar in 2014, which is part of the disputed territories that the Iraqi Kurds and the central government each claim as their own.

Several hundred PKK fighters remain in Sinjar after helping to rescue thousands of Yazidis facing imminent slaughter by the Islamic State. The PKK has since overseen the establishment of local councils and a Yazidi militia known as the Sinjar Resistance Units. Barzani sees all of this as a direct challenge to his government’s authority and says the PKK needs to go.

Turkey feels the same way. The group uses Sinjar to ferry goods and people from Iraqi Kurdistan to the large chunk of northeastern Syria that is controlled by Syrian Kurds, who are loyal to Ocalan and therefore viewed by Turkey as a threat to its national security. Both Barzani and Turkey have threatened to use military force if need be.

Baghdad is said to be backing the PKK presence as a counterweight to the Turkish forces dug in around Bashiqa, west of Mosul, whom Iraqi Prime Minister Haider al-Abadi has repeatedly asked to leave. But as things stand, nobody seems to be leaving anytime soon.