He has survived a revolt, Western air strikes and the defection of some of his closest aides, and now Libyan leader Muammar Gaddafi is hunkering down for a long siege.
In the past few days Gaddafi's administration has emerged from a period of paralysis and started drawing up a blueprint for how to run the country — at least the parts he still controls — while isolated by the outside world.
It is not clear how long Gaddafi can last, but the fact he seems to be digging in for a prolonged stay will be disheartening to Western governments under pressure from war-weary publics to deliver a swift conclusion in Libya.
"The conflict is going to be long and drawn out," said Geoff Porter of North Africa Risk Consulting.
"Over the long term, Libya clearly won't be united again under ... (Gaddafi's) leadership, but it's also increasingly unlikely that the rebels will get anywhere close to Tripoli and without Tripoli there is no rebel victory." There are signs now the internal crisis brought on by foreign minister Moussa Koussa's defection has passed. Gaddafi's son Saif al-Islam has given interviews to the media, officials are back at work and the state media has reported a flurry of instructions from government ministries.
In the first such session since the crisis began, Libya's ministry for industry, economy and trade convened a meeting this week to work out how to ensure supplies of food and medicine in the face of disruption caused by sanctions and air strikes.
Gaddafi's stronghold now is the capital and Libya's western province, known historically as Tripolitania. There, the biggest threat to his hold on power has been not rebels but public anger at a shortage of food and fuel. His administration has been getting to grips with that problem. According to a Tripoli resident, every neighbourhood now has a state-run shop, known as "Government Consumer Societies," which sell subsidised goods.
UN to send probe committee to Libya
The UN is sending a three member commission under a veteran war crimes expert to probe the the human rights excesses in Libya in the ongoing civil war with both rebels and government agreeing to give the panel an access.
Gaddafi has agreed to allow an International Commission of Inquiry to investigate all human rights violations beginning from Sunday, in what appears to be a move to "expose" alleged killing of civilians by NATO forces.