New Maldives President Mohammed Waheed Hassan has vowed to uphold the rule of law following the dramatic resignation of his predecessor Mohamed Nasheed.
Mr Hassan said he intended to form a government of national unity, and confirmed presidential elections would go ahead in 2013 as planned.
However, Mr Nasheed's Maldives Democratic Party (MDP) has accused the opposition of staging a coup.
Mr Nasheed's resignation comes after protests over a senior judge's arrest.
Justice Abdulla Mohamed, arrested by the army amid an outcry last month, was released soon after Mr Hassan took power.
Mr Nasheed's Maldives Democratic Party (MDP) said the president's resignation had been engineered by "rogue elements" of the police and military, along with supporters of former President Maumoon Abdul Gayoom.
"The opposition, supported by the army and police, offered an ultimatum to President Nasheed: step down or be faced with a bloodbath in the capital," the MDP said in a statement.
"President Nasheed thus resigned in order to protect the public from further violence. His resignation was involuntary in that he had no choice."
The MDP said a number of its members and government officials had been injured in overnight unrest, and said it feared for the safety of Mr Nasheed and senior members of his government.
Mr Nasheed's brother Ibrahim told the BBC the former president was now at home, but confirmed he had earlier been held for some hours against his will by security forces who said they were keeping him in the presidential palace for his own safety.
Mr Hassan - the former vice-president - described Mr Nasheed's resignation as a "generous decision... because he has taken into consideration the call from the people and he has also helped to prevent bloodshed".
"Elections will be in 2013 and, God willing, I will try to form a government of national unity and work with all political parties so that we can bring calm and quiet to the streets of Male and also to ensure that the rule of law is upheld," he told the BBC.
'No iron fist'
Mohamed Nasheed announced his resignation during a televised news conference.
"It will be better for the country in the current situation if I resign. I don't want to run the country with an iron fist. I am resigning," he said.
His resignation came within hours of a mutiny in police ranks which saw a few dozen officers side with protesters and then clash with soldiers in the streets.
The mutinying officers took control of the state broadcaster in the capital, Male, and began playing out messages in support of Mr Gayoom.
Reports that the army fired rubber bullets at the protesting police officers were denied by the president's office.
Sarah Harvey, a Briton who works in Male, told the BBC: "Last night was really noisy - there were protesters on foot and on scooters storming down the streets and chanting until the early hours of the morning.
"[Today] there's a curfew in the streets, but a few people are out and about," she added.
"I've heard that MDP activists were encouraging people to come out on the streets tonight to protest against the attempted coup."
Tensions had been escalating since the arrest last month of Judge Abdulla Mohamed, the chief judge of the Criminal Court.
He was accused of being loyal to the opposition by ordering the release of a government critic he said had been illegally detained.
But human rights groups joined opposition and judicial calls for his release - saying the move had been unlawful.
Protests were organised in which demonstrators accused Mr Nasheed of being a dictator.
Mr Nasheed was elected on a wave of optimism in 2008, in the Indian Ocean archipelago's first multi-party election.
The former human rights campaigner beat long-time ruler Mr Gayoom, who had been in power for 30 years and was widely seen as autocratic.
Since then, correspondents say, the country has been gripped by constitutional gridlock - parties opposed to the president have dominated parliament since general elections the following year.
A one-time political prisoner, Mr Nasheed became a vocal figure in office on issues relating to the environment and climate change.
But he has faced constant opposition - from those loyal to former President Gayoom and from religious conservatives who accuse him of being anti-Islamic, says the BBC's South Asia analyst Jill McGivering.
That pressure has intensified with the prospect of next year's presidential elections. Opposition parties are jockeying for power as they try to extend their influence.
The wider question is how this crisis will affect the forthcoming elections - and what it says about the transition in the Maldives to mature democracy, our correspondent says.
The British Foreign Office is advising against "all but essential travel" to the capital Male, where a third of the population live, but says it has received no reports of unrest affecting the airport or tourist areas.