Yemen's former president, who once said that governing the Arabian Peninsula country was akin to "dancing on the heads of snakes," reportedly turned his back on his rebel allies - the Houthis, in a move planned and orchestrated by the oil-rich United Arab Emirates.
After he was toppled from power in 2011, it looked like Ali Abdullah Saleh's dancing days might be over - but for more than six years, the 75-year-old, known for his Machiavellian political manoeuvring, continued to be a key player in a conflict that has brought Yemen to its knees.
In a televised speech on Saturday, Saleh formally broke ties with the Houthis, saying he was open to a dialogue with the Saudi-led coalition that has been at war with his rebel alliance since March 2015.
As army units loyal to him clashed with Houthi fighters in the capital for a fourth successive night, Saleh blamed the rebels for the country's woes, calling on his forces to ignore orders from the Houthi leadership.
"Yemeni citizens have tried to tolerate the recklessness of the Houthis over the last two and half years but cannot anymore," he said.
"I call on our brothers in neighbouring countries … to stop their aggression and lift the blockade … and we will turn the page".
The Houthis, who are believed to be backed by the kingdom's regional rival, Iran, accused Saleh of staging a "coup", vowing to continue their fight against the "forces of aggression".
The Saudi-led coalition that has been bombing Yemen since March 2015, said it welcomed Saleh's overture, praising him for "taking the lead" in a statement carried by the official Saudi Press Agency.
"The decision by [Saleh's] General People's Congress (GPC) to take the lead and side with their people, will free Yemen of ... militias loyal to Iran," the coalition said.
However on Monday, Saleh's long and dominant presence in Yemeni affairs came to an abrupt end after he was brutally killed near Sanaa.
Houthi sources told Al Jazeera that Saleh was killed by the rebels in a rocket-propelled grenade and shooting attack on his car.
Planned in Abu Dhabi
Yemeni officials told Al Jazeera that Saleh's decision to "sideline" the Houthis, which culminated with his death, was planned in Abu Dhabi earlier this year, in consultation with Saudi Arabia.
A Yemeni official told Al Jazeera that the unravelling of the Saleh-Houthi alliance was aimed at carving an exit for the coalition from the conflict.
Speaking on condition of anonymity because he was not authorised to talk to the media, the official said: "Mohammed Bin Salman [Saudi Arabia's crown prince and heir to the throne] has been influenced by the UAE and thinks switching from [Yemeni President Abd-Rabbu Mansour] Hadi to Saleh will help end the war."
Leaked emails written by two former US officials in August suggested that Mohammed bin Salman, also known as MBS, "wanted out" of the war, which he started in March 2015.
When the conflict began, analysts had initially expected the fighting to last only a few months, but the violence has shown no signs of abating, costing the coalition billions of dollars and claiming the lives of at least 87 Emirati troops and an estimated 200 Saudis.
According to the UN, thousands of Yemenis have been killed in the fighting and millions forced from their homes.
"The UAE and Saudi Arabia have lost a lot of men in this war and it seems that with the UAE's help, Saleh, or one of his sons, could end it," the official said.
"In a year or two from now, his son, Ahmed, or even former Prime Minister Khaled Bahah [who currently resides in the UAE], could be the next man to rule Yemen."
Intelligence Online, a Paris-based news and diplomacy publication, reported that MBS sent Ahmed al-Asiri, the former military spokesman for the Saudi-led coalition, to Abu Dhabi in June to meet Saleh's son, Ahmed, and discuss the possibility of forming a new government.
Ahmed, a powerful former military chief who once served as ambassador to the Emirates, has been living in the UAE for the last five years.
The publication also said that Mohammed bin Salman was lobbied by the UAE's Crown Prince, Mohammed bin Zayed, to ditch Hadi in favour of Saleh. It added that Mohammed bin Salman had warmed to the idea of "a return to power of the former Yemeni president."
The UAE's 'trump card'
Murad Alazzany, a Yemeni political analyst and professor at Sanaa University, told Al Jazeera that Saleh's son was the UAE's "trump card" in the conflict.
"The UAE has been keeping a hold of Ahmed should anything happen to his father. In that event, they plan to immediately dispatch him to Yemen to take over his [Saleh's] role," Alazzany said.
"The UAE has always had plans for him. He's a tool, just like how former Afghan President Hamid Karzai was used by the US. When the time is right, they'll use him to do whatever they want."
For more than 30 years, Saleh ruled Yemen with an iron fist, setting up a complicated network of alliances between the country's military, civil and tribal groups.
After handing power to his long-time deputy, Hadi, in 2012, as part of a Gulf and US-brokered deal in exchange for immunity from prosecution, Saleh continued to command several units of the military and chair the powerful GPC party that he founded.
When the Houthis surged south from their northern stronghold of Saada in September 2014, Saleh's system of patronage and corruption enabled them to seize control of Sanaa.
Saleh has been playing the Houthis for years ... He did this when the Salafists started growing in power in the north. Initially he backed them, then he switched and supported the Houthis. Then he betrayed the Houthis. This is what he does.
Mohamed Qubaty, a former Yemeni ambassador
In the lightning offensive, the Saleh-linked Bani Sufyan tribe helped facilitated safe passage for the Houthis through the northern province of Amran.
Most of the Yemeni army subsequently fell under the command of Saleh's relatives or allies, while those who resisted, such as the 310th Armored Brigade in Amran, were easily crushed.
Huge stockpiles of weapons, including tanks, humvees, machine guns, missile launch pads, and large stockpiles of ammunition were obtained by military units, and later shared among Houthi-supporting tribal leaders.
Facing little to no resistance from the soldiers and police posted by Hadi to protect Sanaa, the Houthis asserted their control on the city with the "explicit help from the Republican Guards organised by members of the Saleh family", a UN Security Council report said.
Saudi Arabia, along with several other Sunni Arab countries, then intervened in the conflict, launching an air campaign against the rebels in March 2015, perceiving their advance as an Iranian-orchestrated plot to destabilise the Gulf Cooperation Council (GCC).
In May 2015, following Saudi-led coalition air raids on his home in Sanaa, Saleh officially announced the establishment of his alliance with the Houthis.
A year later, Saleh's GPC party signed an agreement with the Houthis to form a political council to run the country.
A shaky alliance
However, cracks would soon emerge. In August, the Houthis condemned Saleh's description of them as a "militia". Relations would then deteriorate rapidly when Khalid al-Radhi, a senior member of the GPC and close Saleh adviser, was shot dead.
The Houthis, however, told Al Jazeera that they never forged an alliance with Saleh, arguing they had a popular mandate, with most of their fighters coming from historically loyal tribes.
"We didn't need any allies to help fight this war," Mohammed al-Bukhaiti, a spokesman for the Houthis, told Al Jazeera.
"We had no relations whatsoever with Ali Abdullah Saleh. The sons of Yemen banded together to join our ranks to fight against this oppressive Saudi-led coalition and Hadi's militias."
Despite having fought the Houthis for years while in office, Saleh's detractors say his alliance with the Houthis was a "marriage of convenience", with both forces seeking to exact revenge on their mutual foes.
"Saleh played the Houthis for years," Mohamed Qubaty, a former Yemeni ambassador, told Al Jazeera.
"He always used a strategy of playing factions off each other. He did this when the Salafists started growing in power in the north. Initially he backed them, then he switched and supported the Houthis. Then he betrayed the Houthis. This is what he does."
Saleh even played one of his cousins and a member of his Sanhan tribe, the powerful General Ali Mohsin al-Ahmar, Qubaty added.
Ali Mohsin led six sporadic wars against the Houthis before finally defecting from Saleh's government in 2011 and joining the opposition.
"Saleh wanted to weaken Ali Mohsin and other dissident figures within the military who opposed the idea of Ahmed becoming president," Qubaty said.
Tensions between the two had been simmering for more than a decade, when Saleh began pushing for constitutional amendments, one of which included amending the presidential term of office from five to seven years.
This prompted speculation that Saleh wanted to remain in office until 2013, allowing his son Ahmed to reach the age of 40 - the minimum age for a Yemeni president - as per the constitution.
New front in Yemen's war
Residents told Al Jazeera that Saleh's death opened a new front in the country's complex civil war, endangering historic tribal relations.
Osama al-Fakih, a human rights activist, said that coalition air attacks offered the only brief pause to the fighting. He said the sound of heavy shelling reverberated through the city's deserted streets into the early hours of Monday.
A journalist based in Amran told Al Jazeera that the Houthis launched a number of attacks on areas where Saleh loyalists are known to live. The source said that the house of Sheikh Mabkhout al-Mashriqi, a Saleh loyalist and member of the powerful Hashid tribal confederation, was shelled and destroyed on Sunday.
The Hashid tribal confederation reportedly allowed the Houthis safe passage through Amran province before the rebels seized the capital Sanaa.
The International Committee for the Red Cross said dozens of Yemenis had been killed in the fighting and hundreds more injured.
"Our call to all parties: Civilians are not part of the fight," it said.
The clashes underscore an all-too familiar situation in war-ravaged Yemen, with forces loyal to Hadi seeing similar internal fighting between loyalists and pro-independence forces backed by the UAE.
Hadi has fallen out of favour with the UAE, with Abu Dhabi spending billions of dollars to support Aydarous al-Zubaidi, a prominent southern secessionist and prospective rival to the embattled president.
Emirati-backed forces have engaged in fierce firefights with forces loyal to the 72-year-old, and have been accused of preventing the president from returning to the coalition-held city of Aden.
Despite being at war with Yemen for more than two years, the coalition has failed to achieve its stated aim of restoring the "legitimate" government of Hadi.
The Houthis continue to hold most of the north, where more than half of Yemen's population live.
Follow Faisal Edroos on Twitter: @FaisalEdroos