By Sabir Mustafa
Editor, BBC Bengali service
So, after more than two months of political brinkmanship, Bangladesh is now under a state of emergency. Paradoxically though, the worst of the political crisis might be over.
Troops are deployed in the state of emergency
A confrontation which began over the formation of a caretaker government to oversee free and fair polls has peaked with the collapse of the interim administration itself.
But the collapse of the caretaker government now holds out the promise that a free and fair election may indeed take place.
A 'grand alliance' of parties led by the Awami League had threatened to thwart general elections scheduled for 22 January, which they were already boycotting.
They wanted President Iajuddin Ahmed to give up his dual role as head of the caretaker government, reorganise the Election Commission, update the electoral rolls and announce a new timetable for polls.
Faced with a punishing programme of strikes and blockades called by the alliance, President Ahmed finally gave in.
His decision to step down from the caretaker chief's role opens up the possibility that Bangladesh can now look forward to a peaceful, free and fair polls.
That is the optimistic view.
But there are plenty of reasons to be more pessimistic. The road ahead is full of stumbling blocks.
The protests have been going on for months
The president has announced that a new council of advisors will be formed soon. The new government will then consult all parties to organise free and fair polls that no one boycotts.
But there is a catch.
The current crisis is all about confidence. The Awami League and its allies simply did not have any confidence in the caretaker administration headed by President Iajuddin Ahmed, to deliver free and fair polls.
The Awami League felt President Ahmed was merely implementing a plan to rig the elections in favour of its bitter rival, the Bangladesh National Party (BNP). Mr Ahmed was nominated to the post of president by the BNP in 2002.
President Ahmed has stepped down from that role. But questions remain as to how a new caretaker administration will be formed, and what kind of power the president will be able to wield over them.
The Awami League's confidence in the new administration will grow if there are clear moves to reshuffle the civil administration, and remove officers loyal to the previous regime from key election duties. It will reach a peak once the electoral rolls are updated and the Election Commission is fully reorganised.
The sooner the new administration takes these steps, the sooner it can ensure participation of parties in new elections. But the longer the government takes over these reforms, a more likely is a return to street protests and violence.
Bear in mind that the president needed to declare a state of emergency in order to pave the way for his resignation. It allowed him to basically declare the 22 January election schedule dead and buried. It also allows him to maintain some grip over the machinery of state while a new government finds its feet.
But discontent is likely to surface over some of the emergency measures.
Private satellite television channels have been ordered to take their news and current affairs programmes off the air. They have been told to show only news broadcast by the state television.
Newspapers have been told not to publish any editorial critical of the government. All very reminiscent of the bad old 1980s when the country was ruled by a quasi-military dictatorship.
Political and trade union activities, including rallies and demonstrations have been banned. A night curfew is in force in all major towns and cities including the capital, Dhaka.
These are pretty hefty repressive measures, normally associated with military regimes, not one supposedly playing a neutral role to organise free polls.
But one of the major victims of the current crisis may well be the system Bangladesh devised to ensure polls were free and fair.
Since 1996, Bangladesh's constitution has required the elected government to hand over power to a neutral, non-partisan interim administration on the completion of its five-year term. This was an extraordinary admission by politicians that they could not be trusted to hold free and fair polls.
The system worked. Government headed by retired chief justices in 1996 and 2001 produced two of the cleanest elections in the country's history. Turnout exceeding 75% showed the faith voters had in the fairness of polls held under caretaker governments.
But the crisis which erupted in October 2006 showed that politicians could be trusted to subvert even a successful system of their own design.
The outgoing BNP government increased the retirement age of judges, allegedly to ensure that Justice K M Hasan, a former BNP leader, would be in line to head the caretaker government.
Awami League's violent opposition to the judge led to dozens of death, before Mr Hasan stepped aside.
President Ahmed drove a further nail into the system's coffin by taking over the role himself, raising suspicion that the caretaker government would not perform neutrally.
With another administration due to take over, it remains to be see whether the new government can recover public faith, and save the unique system which has served Bangladesh well over the past decade.