By Roland Buerk
BBC News, Dhaka
President Iajuddin Ahmed did not smile once as he was sworn in as the head of Bangladesh's temporary government.
Mr Ahmed tried to find other candidates for the role
Previously only titular head of state, a huge responsibility was falling onto his shoulders.
He must run the country for up to three months in the lead-up to an election, and hold the ring between warring political parties.
"Pray for me," he told reporters.
Mr Ahmed had spent the day before he took the oath trying to find someone else for the job - his critics say he should have tried harder.
He held meetings with the leaders of Bangladesh's four main parties, searching for a consensus over who should be chief adviser to the caretaker government.
For now Bangladesh seems to have stepped back from the brink
In moments of high drama it was announced from the president's palace that there had been no agreement, but a swearing-in ceremony would take place anyway.
It was not until minutes before the broadcast began on state-run television that it became clear that Iajuddin Ahmed had nominated himself.
He was sworn in by the bewigged chief justice in front of an audience of diplomats, former ministers and generals.
The Awami League, which was the biggest party in opposition, stayed away.
The post of chief adviser to the caretaker government had fallen vacant amid bloodshed in the streets.
The elected prime minister, Khaleda Zia, should have handed over to KM Hasan, the last chief justice to retire, after her mandate expired on Friday.
The nomination of a different candidate sparked protests
Bangladesh's constitution establishes a supposedly neutral caretaker government that runs the country for up to 90 days before an election so that an outgoing ruling party cannot rig the polls.
But the opposition Awami League and its allies objected to Mr Hasan, saying he could not be in charge because he was too close to Khaleda Zia's party.
As the prime minister's final hours in power ticked away, the streets burst into violence. Huge crowds of supporters of rival political parties fought each other and the police.
There were gunshots and small explosions. People were killed and hundreds more injured.
After 24 hours Mr Hasan announced he would not take the job, for the good of the country.
'Back from the brink'
Now that Mr Ahmed is in charge he faces many challenges, for which he has little experience.
Before he was chosen to be president, he had spent his life in academia. He was a professor of soil science at Dhaka University and made a special study of the effect of salinity on Bangladesh's low-lying paddy fields.
Although he is not a member of any party, he was known at the university to be a supporter of Khaleda Zia's BNP (Bangladesh Nationalist Party).
The Awami League has neither accepted nor rejected his rule, but says he must now prove he is neutral.
The party's leader, Sheikh Hasina, has handed him a list of demands.
They include replacing the chief election commissioner and his deputies - the Awami League says they are also biased towards the BNP - and updating the voter list with photographs.
For now Bangladesh seems to have stepped back from the brink.
Had the Awami League rejected outright Mr Ahmed's assumption of power, many in the country feared the only option he would have had left would have been to declare an emergency and call the army onto the streets to maintain order.
But the threat of more upheaval remains.
The Awami League has given Mr Ahmed until Friday to comply with their demands or full scale protests will resume.