Sanaa: Ali Abdullah Saleh, who once compared his 33-year rule of Yemen to "dancing on the heads of snakes," formally steps down this week after Yemenis anoint a new president in an election many hope, will give Yemen a chance for democracy.
No ceremonies are expected to mark the end for Saleh, who is out of the country being treated in the United States for injuries he sustained in an assassination attempt last June.
But the election, in which Saleh`s deputy Abd-Rabbu Mansour Hadi is the only candidate, is expected to pave the way for Yemen to introduce political and economic reforms and give it a chance to restructure security forces currently run by the outgoing president`s relatives.
Before he flew to the United States last month, Saleh apologized for "any shortcoming" in his rule and said he planned to come back. "I will return to Sanaa as head of the General People`s Congress party," he told senior party and government officials in a televised speech before his departure on January 22.
From January 2011 he struggled to quell big popular protests against his rule as a spate of gunbattles pushed Yemen closer to civil war. The violence culminated in deadly clashes between forces of the Hashed tribal group and government troops. Under mounting pressure, Saleh agreed to sign a Gulf accord in November that was meant to see him gradually relinquish power.
But fears remain that the accord, inked in Saudi Arabia, the world`s No. 1 oil exporter which shares a long porous border with Yemen, may not provide the impoverished Arabian Peninsula state with a roadmap out of misery and chaos.
The bombing of Saleh`s compound in June, an apparent assassination attempt, left Saleh with severe burns, forcing him to seek treatment in Saudi Arabia, one of Yemen`s resource-rich neighbors which had tried in vain to ease him from power.
Ever nimble, Saleh reneged on three deals to transfer power before the attempt on his life and shrugged off US and Saudi pressure to stay in exile, making good on a promise to return home in September.
But international pressure redoubled in October, when the UN Security Council adopted a resolution demanding he sign a handover plan brokered by Gulf neighbors. France and Britain hinted at European Union sanctions against him.
The United States has talked openly of its concern about who might succeed Saleh, an ally in the fight against al Qaeda in the Arabian Peninsula, a Yemen-based wing of the militant group.
Until last year, Saleh`s grip on power seemed unshakeable. In 2010, supporters pushed for constitutional changes to allow him unlimited five-year terms as president. Speculation was high that he was grooming one of his sons as a possible successor.
But popular uprisings that toppled Tunisian President Zine al-Abidine Ben Ali and Egypt`s Hosni Mubarak resonated in Yemen, drawing tens of thousands to daily protests in Sanaa and in Taiz to the south, threatening his apparent dynastic ambitions.
Saleh began to offer concessions.
First, he said he would not stand for re-election in 2013 and dismissed the idea of his son succeeding him. Then he offered a referendum on a new constitution by the end of the year and a shift to a truly democratic "parliamentary system."
But after the death of 52 protesters in March, mostly by sniper fire, a string of generals, tribal leaders, diplomats and ministers either resigned or switched their allegiance to the protesters.
They included key figures in the al-Ahmar and Sanhan tribes, kinsmen who Saleh had placed in key military and other positions.
When confronted with a power transfer deal brokered by the six-member Gulf Cooperation Council, Saleh was forced to accept that he has lost the ability to win back his former allies, and sign up to the deal.
Saleh became the ruler of North Yemen in 1978 at a time when the south was a separate communist country, and has led the unified country since the two states merged in 1990.
Opponents often complained that he failed to address the basic needs of Yemen`s people, two-thirds of whom live on less than $2 per day. Oil wealth is dwindling and water is running out, though liquefied natural gas exports began in 2009.
Yet Saleh managed to keep Western and Arab powers on side.
After the September 11, 2001 attacks on US cities, Washington became more aware of Yemen as a source of foot soldiers for Osama bin Laden`s al Qaeda network. Bin Laden himself, though born in Saudi Arabia, could trace his roots back to Yemen`s Hadramaut region.
Saleh cooperated with US authorities, and the CIA started taking action against wanted figures. But by 2007, militants had regrouped in Yemen, and in 2008 they announced that their Saudi and Yemeni wings had united under the banner of al Qaeda in the Arabian Peninsula.
From 2009, the resurgent group made ever bolder attempts to stage attacks on Saudi and US targets beyond Yemen, as well as targeting foreign tourists at home. At the same time, Shi`ite Muslims in the north rebelled against Saleh`s rule and southerners, feeling marginalized, began a new separatist drive.
Saudi Arabia, the United States and other allies responded by stepping up financial support to bolster Saleh`s rule.
If Saleh has been a determined survivor, he has also been a charismatic and often popular ruler with a canny understanding of the workings of Yemeni society.
Born in 1942 near Sanaa, Saleh had only limited education before joining the military as a non-commissioned officer.
His first break came when President Ahmed al-Ghashmi, who came from the same Hashed tribe as Saleh, appointed him military governor of Taiz, North Yemen`s second city. When Ghashmi was killed by a bomb in 1978, Saleh replaced him.
In 1990, an array of domestic and regional circumstances propelled North Yemen under Saleh and the socialist South Yemen state into a unification that Saudi Arabia at first opposed.
He angered Riyadh by staying close to Saddam Hussein during the 1990-91 Iraqi occupation of Kuwait, leading to the expulsion of up to one million Yemenis from Saudi Arabia. Before the crisis, Kuwait had given Yemen financial aid.
But Saleh then won plaudits from Western powers for carrying out economic reforms drawn up by the International Monetary Fund and World Bank, and made efforts to attract foreign investors.
His General People`s Congress party swept to victory in a 1993 parliamentary election, the first held after unification. South Yemen tried but failed to secede in a brief civil war in 1994 and Saleh then proceeded to move closer to Saudi Arabia, allowing an influx of its radical Wahhabi form of Sunni Islam.