Pervez Musharraf's doomed homecoming to Pakistan
Since his return to the Pakistan last month, former military ruler Pervez Musharraf has stumbled from one problem to another.
His difficulties have gone from bad to worse.
Days after he ended his self-imposed exile, he suffered the insult of having a shoe thrown at him in a crowded corridor of a court building in Karachi, narrowly missing him.
Just over a week later, the Supreme Court instituted hearings to explore if he could be put on trial for treason.
On Tuesday, an election tribunal ended his run for the parliament by declaring he could not be a candidate.
And just when the echo of that rejection was subsiding, a court in the capital, Islamabad, on Thursday rejected his plea for bail, paving the way for his arrest on Friday.
Did he really anticipate all this when he decided to return to the country?
It is anybody's guess, a question only he can answer.
One commentator with knowledge of the military said on a recent television news show that Mr Musharraf certainly took into account the legal challenges he faced in the country, including the possibility of his arrest.
Hours after his bail was rejected, one of his lawyers said he was calm and collected, "drinking coffee and smoking a cigar" with his aides at his residence.
But that is not how top officials of the country's interim government will be feeling. For them Mr Musharraf has seriously upset the applecart.
The primary job of the caretaker government is to hold elections. And it already has its hands full.
Militant attacks on mostly secular political forces across the country are already putting a question mark over the government's ability to hold fair elections on time by 11 May.
Arresting Mr Musharraf, a former army chief, is an unprecedented move fraught with negative ramifications which many say only a permanent government, having the support of the voters behind it, ought to be handling.
Separately, the judiciary's move to try Mr Musharraf for high treason is another potential distraction, because it is the executive authority that has to institute a case.
If the government persists with it, the powerful military will feel threatened because - as the theory goes - the onslaught will not stop with Mr Musharraf.
The proactive role of the judiciary over the past two years has seen it visibly encroach on territory normally occupied by the executive. There is no reason why the military should not feel a similar threat.
So while Mr Musharraf may be sitting comfortably drinking coffee, analysts feel he has created problems for everyone by returning to the country.
Sources close to military insiders say the army high command was not in favour of Mr Musharraf returning, the last warning being conveyed to him a month before his return.
So was his decision to return based on guarantees provided by countries like Saudi Arabia, which has often negotiated peace deals among Pakistan's warring rulers in the past?
One of the most ardent supporters of the idea of prosecuting Mr Musharraf for high treason was former Prime Minister Nawaz Sharif, who Mr Musharraf deposed following a coup in 1999 and forced into exile to Saudi Arabia.
Since Mr Musharraf's return, he has been noticeably quiet on this issue, leading many to suspect there may indeed be a Saudi role.
This is a particularly sensitive time for the future of democracy in Pakistan, analysts say, and the country can ill-afford more instability than it already has.