Barely two months after being elected, Bangladeshi Prime Minister Sheikh Hasina has found herself having to deal with a crisis in which the stakes were terrifyingly high.
The death toll from this week's mutiny staged by the country's border security force, the Bangladesh Rifles (BDR) may be steadily rising, but the consensus among commentators in Dhaka is that a far bigger blood bath has still been averted.
The prime minister has been credited with not allowing the military to take control as they have in the past.
"On this point nearly everyone is agreed," says the BBC's Bengali section head, Sabir Mustafa. "From the outset Sheikh Hasina took command of the crisis and handled it with confidence and determination.
"There was every chance after the the mutiny began that the army could have taken matters into their own hands, stormed the BDR headquarters and carried out revenge killings for the loss of their officers. That would unquestionably have led to a far higher death toll than we have at present.
"But this did not happen because the prime minister ensured that the army stayed under her command and the crisis was solved by politicians."
The prime minister's address to the nation on Tuesday night has been widely acclaimed as an important turning point in the crisis.
In it she sent out a strong message to the mutineers that they had no option but to lay down their arms.
She also tacitly informed the army that she was the person in charge of the crisis and she would be the person who would be dealing with it.
The fact that the stand-off was resolved by Bangladesh's democratically elected government rather than the military - which for many years has been a dominant force in the country - is hugely important.
It shows the outside world that Bangladesh is run by a stable civilian administration and that the army is now accountable to it.
It is a message that will not go unnoticed by outside investors, foreign aid agencies and the UN - all of which are eager to strengthen their presence in the country.
So if Sheikh Hasina wins plaudits for her decisive handling of the stand-off - despite the relatively high number of casualties - could she have foreseen such a development in the first place?
Most commentators agree that she was in no position to do so. They argue that the prime minister only came to power in December and had no time to be fully aware of the high level of discontent within the BDR.
Some reports from Dhaka say she was prevented from meeting rank-and-file BDR members when she visited their headquarters on Tuesday, just hours ahead of the coup.
It is alleged that army officers who command the BDR's 70,000 personnel felt that such a meeting would not have been appropriate and deleted it from the prime minister's schedule.
This move reportedly triggered a heated argument just before the mutiny between some BDR personnel and senior army officers - it was the "straw that broke the camel's back" according to Sabir Mustafa.
So if the prime minister is exonerated, who should take the blame for not foreseeing the mutiny?
Most fingers point at the country's various intelligence agencies. It is likely that the mutiny will lead to a substantial revamp of the Directorate General of Forces Intelligence, National Security Intelligence and the Special Branch of the police who, it is argued, should all in different ways have been more alert to the dangers.
Another likely spin-off from the mutiny is reform of the BDR, which needs to be done urgently.
"At the moment the country's borders are closed and there are 70,000 paramilitary border personnel with no leadership," says the BBC's Waliur Rahman in Dhaka.
One suggestion is that retired army officers - with no connection to the recent hostilities - be put in temporary charge of the BDR until longer term replacements can be found.
"Measures also need to be taken immediately for officers of the BDR to come from within the regiment itself - rather than just from the army - and steps need to be taken to promote more non-commissioned officers," says Waliur Rahman.
The army itself cannot expect to emerge from the mutiny unreformed. The top commander is due to retire soon and the expectation is that his successor will be a political appointee who will have no qualms about deferring to Sheikh Hasina.
"Efforts are now almost certain to take place to consolidate civilian control over the army, possibly by the formation of a national security council," says Sabir Mustafa.
"The army have not emerged from this crisis with much credit. There was widespread resentment - even before the mutiny - that junior officers in particular lorded it over everyone.
"People did not like the military's lack of accountability."
Meanwhile the military must rebuild following the loss of several senior officers in the coup.
With the army weakened and an opposition Bangladesh Nationalist Party still smarting from its recent poll trouncing, Sheikh Hasina seems to have emerged from the mutiny in a stronger position than ever.