The president of Iraqi Kurdistan visited southeastern Turkey for the first time in two decades on Saturday, a trip meant to shore up support for a flagging Kurdish peace process there and bolster Turkey's influence across its troubled southern borders.
Thousands gathered as Masoud Barzani arrived in a long convoy of cars, a police helicopter buzzing overhead, in Diyarbakir, the main city in Turkey's Kurdish-dominated southeast, for a meeting with Prime Minister Tayyip Erdogan.
Crowds waved green, white and orange Kurdistan flags ahead of ceremonies due to include a performance by Kurdish poet and singer Sivan Perwer, who had fled Turkey in the 1970s, and a mass wedding of 300 couples.
"We will see a historic process in Diyarbakir this weekend," Erdogan said ahead of the visit, billing the event as the "crown" on efforts to end a three-decade insurgency by Kurdistan Workers Party (PKK) militants which has cost 40,000 lives.
Kurds, often described as the world's largest stateless ethnic group, number about 30 million, concentrated in parts of Turkey, Iran, Syria and Iraq. While they have had partial autonomy in Iraqi Kurdistan since 1991, nationalist movements have long been suppressed in Turkey, Syria and Iran.
Turkey's efforts to make peace with the PKK has been given a fresh sense of urgency by Syria's 2-1/2 year civil war, in which Kurds have made major territorial gains in recent weeks, paving the way for their long-declared plans for independent governance in parts of Syria just over Turkey's southern border.
Erdogan is keen to press the peace process in the run-up to municipal elections next March, with his ruling AK Party looking to tempt Turkish Kurds away from the pro-Kurdish Peace and Democracy Party (BDP), which shares the same grassroots support as the PKK and currently governs Diyarbakir.
But peace moves have stalled since a ceasefire declaration in March, with the PKK saying a package of reforms announced by Ankara last month, meant to boost Kurdish rights, had fallen well short of expectations.
On the eve of Barzani's visit, the Turkish army said Kurdish militants attacked a military convoy near the Syrian border with rifle fire and a rocket-propelled grenade, one of the most serious breaches of the 8-month old truce.
In a residential part of town, hundreds attended a counter rally by the BDP, which has dismissed Barzani's visit as a show staged by the AK Party. "Barzani, will you be a candidate for the AKP in Diyarbakir?" read the banner on a party bus.
"Barzani should take into consideration the sensitivities of the Diyarbakir people," BDP official Mehmet Amin Yilmaz said in an address to the crowd. "Erdogan has not taken concrete steps for the rights of the Kurdish people."
Barzani's visit is about much more than local politics. Turkey and Iraqi Kurdistan share concern about the growing clout of Kurdish militias in Syria, particularly after their announcement this week of an interim administration that aims to carve out an autonomous Syrian Kurdish region.
Both Turkish and Iraqi Kurdish officials in Arbil have criticised the declaration, which lays out plans for a regional government similar to that of Iraqi Kurdistan, seeing it as part of a deal with Syrian President Bashar al-Assad.
Syrian Kurds themselves are divided over the political group whose militias are behind the advances, the Democratic Union Party (PYD), which has links to the PKK and is seen by Iraqi Kurdistan as a rival for transnational leadership of the Kurds.
Critics of the PYD also accuse it of getting help from outside powers - namely the regional Shi'ite power Iran and Iraq's Shi'ite-controlled central government, which are both allies of Assad.
"Erdogan needs to strengthen his hand with Barzani in Turkey's own Kurdish problem and in developments with Syrian Kurds," wrote columnist Cengiz Candar in Turkey's Radikal daily.
"But Barzani also needs to get Turkey's backing in Iran, Syria and Baghdad," he said.
Turkey's courtship of Iraqi Kurdistan, in particular its efforts to help the region develop an independent oil industry, has long infuriated Baghdad, which fears the break-up of Iraq, and has also raised concerns in Washington.
The semi-autonomous region has finalised a package of deals with Turkey to build multi-billion dollar pipelines to ship its oil and gas to world markets, sources involved in the negotiations told Reuters last week.
But in a delicate foreign policy balance, Ankara has at the same time been seeking to restore relations with Baghdad, which claims the sole authority to manage Iraqi oil, vowing to respect Iraq's territorial integrity and offering to set up an escrow account through which oil revenues could be shared.
"The most critical issue is how to set up a new balance in the Ankara-Arbil-Baghdad triangle," columnist Fehim Tastekin wrote on Middle Eastern news website Al-Monitor ahead of Barzani's visit to Turkey.
"What (Erdogan's) dancing with Erbil and Baghdad at the same time promises to the three parties is simple: if oil and natural gas flow through pipelines with an agreement among the parties, all three will win."