Ali Abdullah Saleh dominated political life in Yemen for decades, even after his country and international allies forced him from the presidency more than five years ago.
The 75-year-old had spent years setting up a complicated network of alliances between the country’s military, civil and tribal groups, fuelling societal divisions by playing enemies off one another in a bid to weaken his opposition.
The veteran politician likened this survival technique to “dancing on the heads of snakes,” a slogan which appears to reflect the circumstances of his untimely death.
On Saturday, Saleh publicly broke ties with his former allies, the Houthis, calling on Yemenis to “defend the nation” against them.
That move, one in a lifetime of juggling alliances, proved to be his last and he was brutally killed by the rebels in a rocket-propelled grenade and shooting attack on his car.
His death is likely to have a massive impact on the prospect of peace, and further inflame tensions in one of the world’s most fractious countries.
Saleh was born in 1946 in the town of Bayt al-Ahmar, some 20km southeast of the capital Sanaa, to the Sanhan tribe, a lesser known branch of the Hashid tribal grouping.
With minimal education, he rose through the ranks of the military and spent his early years fighting for the republican government in North Yemen’s civil war, which pitted the Saudi-backed remnants of the monarchy against Egyptian-sponsored republicans.
He remained active in the army until 1978, when North Yemen’s third president in nearly four years was assassinated.
After spending years learning the craft of how to handle people, a four-man presidential council including Saleh took over the country. Within a month, Saleh emerged as the president of the Yemen Arab Republic.
Expectations for his presidency were low. An estimate from the CIA predicted that he would not last six months in office. But he held on, consolidating power within the ruling General People’s Congress (GPC) and buying the support of the country’s fractious tribes.
He was re-elected in 1982, and again in 1988.
Saleh then presided over the unification of North Yemen with the Communist South in 1990, which lost its main patron when the Soviet Union collapsed.
The marriage quickly soured, though, with the south frustrated by what it saw as its economic marginalisation at the hands of the northern-dominated government.
Still, Saleh proved to be a wily political operator, manipulating the country’s tribal system and fending off sustained insurrections in both the north and south.
When civil war broke out in mid-1994, and the South seceded in May of that year, its separation would last only two months, before its military was crushed by the North, placing Saleh once again at the helm of a unified Yemen.
Saleh was also an ally of former Iraqi strongman Saddam Hussein, and his decision to back Iraq during the first Gulf War had serious consequences for Yemen’s economy.
Saudi Arabia responded by expelling more than a million Yemeni workers from the Kingdom, depriving countless Yemeni families of vital remittances.
After the September 11 attacks, Saleh tried to position himself as an important ally of the United States. He made an official visit to Washington in 2007, where he met with then-president George W Bush at the White House.
He allowed American drone aircrafts to kill alleged al-Qaeda targets on Yemeni soil, and in return, Yemen became the recipient of tens of millions of dollars in American aid.
After his removal, the UN Security Council found that he had amassed between $32bn and $60bn through corruption during his 33 years in power.
The 2015 report stated that Saleh’s assets were stashed in at least 20 countries, and the team planned on investigating the former leader’s connections with businessmen, who were helping him hide the funds.
Saleh’s failures as president fuelled months of popular protests which began in January 2011, shortly after the removal of Tunisian president Zine El Abidine Ben Ali.
At the onset of the uprising, Yemen was one of the poorest countries in the world, with widespread unemployment and persistent inflation, its billions of dollars in oil revenues embezzled or wasted. Forty percent of Yemen’s population lived on less than $2 a day.
As the protest movement grew, Saleh failed to stave off accusations that he was seeking 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 to become president – as per the constitution.
Protesters spent months camped in front of Sanaa University, where they erected tents and chanted for Saleh’s resignation.
Demonstrations also spread to several other Yemeni cities, with the southern city of Taiz emerging as an epicentre.
When the turnout at some rallies reached hundreds of thousands of people, several high-ranking military officers deserted Saleh. Tensions mounted further after a particularly brutal crackdown on March 18, when at least 50 protesters were killed by snipers in Sanaa.
General Ali Mohsen Saleh was the first to go. He ordered the troops under his command to protect the protesters.
The Houthis, a group of Shia rebels who fought a long-running war with Saleh’s government, endorsed the protest movement; so did the Southern Movement, a secessionist movement in the south.
The protests also emboldened the al-Ahmar family, fellow members of Saleh’s Hashed tribal grouping who emerged as his chief political opponents.
Hamid al-Ahmar, a prominent businessman, was seen as a possible successor to Saleh, while his brother, Hussein al-Ahmar, quit the ruling party in February and publicly rebuked Saleh.
Saleh repeatedly portrayed himself as the only man who could hold Yemen together.
In the early days of the protests, he portrayed the opposition as a conspiracy to destroy the country – a theme he repeatedly used during his decades in power.
“There is a conspiracy against Yemen’s unity and territorial integrity,” he told a group of senior military officers. “We have served to preserve the republican regime with every drop of blood we have.”
However, Saleh then tried to negotiate his way out of the protests, offering to form a “unity government” and proposing a committee to overhaul the constitution. Opposition groups dismissed his offer as a “waste of time”.
Saleh later offered to step down, promising to hand power over to a civilian government. The opposition rejected that offer, holding out for a more immediate resignation.
The former president also tried to buy his way out of trouble, offering tens of thousands of dollars (and new cars) to tribal elders. But his tribal support, which constitutes his main power base, was eroding.
Neighbouring countries tried to broker a peaceful exit for Saleh. A proposal negotiated by the GCC would have granted him immunity from prosecution in exchange for stepping down. But he refused – on three different occasions – to sign the deal.
Saleh steps down
He transferred power to his deputy of 18 years, Abd-Rabbu Mansour Hadi, before an early election, and in return, received immunity from prosecution.
However, he left behind a government that was ill-equipped to handle the set of interlocking challenges confronting Yemen, including dwindling oil and water reserves and a rapidly growing population of unemployed youth.
At the time of his departure, his government was ranked as one of the most corrupt in the world.
“A system of grand corruption has emerged over the last several decades thriving on the combination of weak state institutions and a fragmented elite structure,” the US embassy in Sanaa said in a 2010 report.
“Allies are rewarded and other elites pacified by grand patronage payoffs in exchange for political quiescence.”
However, a few years after he was deposed, Saleh resurfaced when he allied with Houthi fighters in 2015.
While there had been six wars between Saleh’s government and the Houthis, Saleh officially announced the establishment of his alliance with the rebels following Saudi-led air strikes on his home.
Prior to this alliance, the UN Security Council had imposed sanctions on Saleh, along with two allied rebel commanders, for threatening peace and stability in the country and obstructing the political process.
The UN decision came after thousands of Saleh and Houthi supporters filled the streets of Sanaa, to protest the punishment of the former president in November 2014.
There were also allegations of leaked phone conversations between Saleh and Houthis a month after the group took Sanaa in 2014.
In the audio recording, received by Al Jazeera in January 2015, Saleh could be heard coordinating military and political moves with Abdul Wahid Abu Ras, a Houthi leader. The audio was reportedly recorded in October.
In 2016, at the revolution’s anniversary, Saleh made a rare appearance at a large gathering in Sanaa. He attempted to offer an olive branch to the coalition. “We extend a hand of peace, the peace of the brave, for the direct talks with the Saudi regime without a return to the (UN) Security Council, which is incapable of resolving anything,” Saleh told the crowd.
That same year, he signed a Houthi-appointed political council that allowed them to run the country from Sanaa.
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.
In December of this year, Saleh, speaking during a televised address, formally broke ties with the Houthis, saying he was open to talks with the Saudi-led coalition .
He blamed the rebels for the country’s crisis, calling on forces loyal to him to ignore orders from the Houthi leadership.
The Houthis accused Saleh of staging a “coup” and Yemeni officials told Al Jazeera that Saleh’s decision to break the alliance was planned by Abu Dhabi earlier this year.
A Yemeni official, who spoke on the condition of anonymity, said the decision was aimed at finding a way for the coalition to exit the war.
On December 4, just days after he announced his willingness for dialogue with the Saudi-led coalition, Saleh was killed in Sanaa.
Houthi sources told Al Jazeera that Saleh was killed by the rebels in a rocket-propelled grenade and shooting attack on his car.
Footage on social media appeared to show a body resembling Saleh’s, with one video showing how fighters used a blanket to move his corpse to the back of a pick-up truck.
Hakim al-Masmari, the editor-in-chief of the Yemen Post, described Saleh as “probably the most powerful person” in Yemen and said the reports of his death had left the country “in shock and awe”.
“You can not say this is the end of his political movement, but it’s a very big blow,” he said.
“But this is far from over – Saleh was an icon in Yemen for millions, and so his death will not go slowly or unanswered.”
Follow Al Jazeera’s Faisal Edroos on Twitter: @FaisalEdroos