* President's stroke opens dangerous power vacuum
* Shots show potential for violence between Kurdish groups
* Turkey, Iran jostle for influence
By Isabel Coles
SULAIMANIYAH, Iraq, April 29 Celebratory gunfire broke out in Iraq's Kurdish north as the octogenarian was shown on television raising an ink-stained finger after casting his vote thousands of miles away in Germany.
The man was Iraqi President Jalal Talabani and his silent appearance at an early ballot for the election due at home on Wednesday was the first footage of him since he suffered a stroke late in 2012 and was flown abroad for medical treatment.
In Sulaimaniyah, capital of the province of the same name where his Patriotic Union of Kurdistan (PUK) is headquartered, cars blared their horns and people, some wearing T-shirts printed with Talabani's face, danced on the streets.
Cause for festivities may be short-lived. Wednesday's election marks a new round in an internal power struggle that risks turning violent and skewing the balance of power in Kurdistan between influential neighbours Iran and Turkey.
The parliamentary vote is being contested as bitterly within each of Iraq's ethnic and sectarian constituencies as between them -- if not more so.
Among the Kurds, long at odds with Baghdad and in charge of their own quasi-state in the north of the country, rivalries have prevented the formation of a government more than seven months after elections in the oil-rich enclave.
This election, amounts, for them, to a referendum on Talabani's PUK, left rudderless and internally riven without the ailing statesman, known affectionately as "dear uncle".
The PUK's fading star has upset the region's time-worn political order, raising concerns about stability, particularly in Sulaimaniyah province, which Talabani's party has controlled since Kurdistan gained autonomy more than three decades ago.
Last week, gunmen waving the PUK's green flag drove past a branch of the Kurdistan Democratic Party (KDP) on Sulaimaniyah's main street and opened fire. The mayor said "dark hands" were behind the incident, in which there were no casualties.
Member of parliament Ari Harsin later stood guard at the scene with a machine gun slung over his shoulder. "I took up arms because no-one is in charge of Suleimaniyah," he said in a television interview. "I am defending democracy".
The shooting took place just days after an agreement was signed to finally form a new cabinet that would sideline the PUK, which has shared power with the KDP for almost a decade but fell to third place at the polls last September.
It was overtaken by opposition party Gorran (Change), which grew out of a former wing of the PUK and quickly gained popularity among Kurds fed up with the corruption of the region's traditional ruling elites.
In this election, the PUK is hoping to regain stature through Kirkuk - an ethnically mixed city where the party enjoys support outside the formal boundary of Kurdistan. That would give the PUK much-needed leverage in ongoing negotiations over government formation.
"They lost the (local) election and they must accept it," said the head of Gorran's electoral list Aram Sheikh Mohammed at the party's hilltop headquarters in Suleimaniyah, from an office that commands a view of the mountains surrounding the city.
"The PUK needs to wake up: they are still in a deep sleep".
Formed at a cafe in the Syrian capital Damascus in 1975, the PUK gathered disparate left-leaning Kurdish groups under its umbrella as an alternative to the KDP, which revolves around the Barzani tribe and dominates the region's other two provinces.
With no clear chain of command, cracks in the PUK have widened and the party is now incapacitated by competition between different factions, one of which is led by the wife of its infirm leader. But talk of its demise may be premature.
In Sulaimaniyah, the PUK's financial and military muscle is still unrivalled. The party has its own security apparatus, "peshmerga" fighting force, and a vast network of patronage built around a business empire that includes fuel trading and real estate.
Faced with being left out in the cold, some members of the PUK have made veiled threats, reminding people they owe allegiance to political parties over and above the institutions of the relatively young Kurdish regional government.
But if the PUK's patronage system begins to unwind, loyalties could shift. Several members of the PUK have already jumped ship and joined the KDP in recent weeks.
"It's never going to simply slide away into nothing quietly," said Gareth Stansfield, Senior Associate Fellow at the Royal United Services Institute (RUSI).
"It could change with more defections from the party to others; it could see some form of reunion with Gorran, as seemed to be happening before Talabani's illness; or it could fail catastrophically, and by that I mean a decline into conflict."
The acid test may be provincial elections, to be held this week alongside the Iraqi national vote, but in Kurdistan alone, and for the first time since the birth of Gorran, which could come out on top.
"It's difficult to envisage how they will behave," said a source close to decision-makers in all three main parties. "I don't think any party wants to go as far as confrontation."
For now, they are waging war through the media. PUK outlets have sought to smear Gorran's candidate for governor by publishing poems he wrote for a newspaper of the Baath party of deposed dictator Saddam Hussein, who presided over the mass killing of Kurds in the 1980s.
But many worry there is a potential for conflict in a region where many men own firearms and the older generation fought a guerilla war against Saddam's forces before turning their weapons on each other.
"Kurds don't point fingers, we point guns," the head of Kurdistan's security council Masrour Barzani told a U.S. diplomat in 2009 during a discussion about elections, according to a cable released by anti-secrecy site Wikileaks.
Officials in the KDP are worried about the PUK's implosion at a time when insurgents are gaining ground in the rest of Iraq, and across the border in Syria, warning that security in Suleimaniyah is a "red line".
A rare bombing in the regional capital Arbil days after the election in September has been followed by several smaller attacks in Sulaimaniyah. Sticky bombs were attached to the vehicles of two officers and an explosive device was detonated outside the house of a colonel.
The head of the security services in Sulaimaniyah took umbrage at the suggestion the province was not secure, and said his men had recently managed to thwart an attack by militants from the Islamic State in Iraq and the Levant (ISIL).
The PUK's health is also of concern for Iran, which shares a long border with Suleimaniyah province and has historically been close to Talabani and his party, counteracting Turkey's growing influence over the KDP.
"Iran is very, very concerned about the future of the PUK," said a senior KDP official on condition of anonymity. "Talabani is out of the picture, but the PUK has some institutions Iran needs".
As early as 2008, Kurdish Prime Minister Nechirvan Barzani fretted about PUK succession, predicting "chaos" could follow Talabani's exit and create opportunities for Iran to meddle more in Sulaimaniyah, according to a U.S. diplomatic cable released by Wikileaks.
Since the September election, PUK leaders have gone to Tehran for talks, and Iranian officials have visited Kurdistan to lobby on behalf of the ailing party and preserve its own interests in the region.
"It's a dangerous neighbourhood," said another KDP source who declined to be named. "They (our detractors) can easily destabilise us, especially if we are not united". (Editing by Philippa Fletcher)