Maldives President Mohamed Nasheed has resigned after weeks of demonstrations and a mutiny by some police officers.
In an address on state TV, he said it would be "better for the country in the current situation" if he stood down.
Earlier, a group of mutinying police officers took control of the state broadcaster in the capital, Male.
Tensions escalated after the Maldives army arrested a senior judge last month, prompting bitter street protests in the Indian Ocean island chain.
A source close to the president described Tuesday's developments as a "coup by the former regime".
Mr 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," Mr Nasheed said.
He is expected to hand over power to Vice-President Muhammad Waheed Hassan.
Earlier, sources in the office of President Nasheed told the BBC a group of policemen had taken over the state broadcaster and began playing out messages in support of former President Maumoon Abdul Gayoom.
Several journalists were said to be detained in the facility.
Sources in the office of Mr Nasheed told the BBC Tuesday's protest took place in front of military headquarters, a high-security zone.
Soldiers used tear gas to break up a demonstration by supporters of Maumoon Abdul Gayoom.
On Monday, around 50 policemen stood down in favour of the protesters and refused to obey orders.
The president's office denied reports that the army fired rubber bullets at the protesting police officers.
Last month the army arrested a senior criminal court judge, Judge Abdulla Mohamed.
The government alleged that the judge's rulings - such as the release of an opposition activist detained without a warrant - were politically motivated.
It claimed the dispute with the judge was not an isolated incident, but indicative of a more deep-rooted problem with the Maldives judicial system and the checks and balances it has to ensure it stays independent.
Human rights groups added their voices to calls for the judge to be released - and, as things grew increasingly heated, there were demands for the United Nations to be brought in to resolve the dispute.
Correspondents say since 2008 elections brought former human rights campaigner Mohammed Nasheed to the presidency, the Maldives has been gripped by constitutional gridlock - especially because parties opposed to him now dominate parliament.
Mr Nasheed beat long-time ruler Maumoon Abdul Gayoom, who had been in power for 30 years and was widely seen as autocratic, in the country's first multiparty election.
Mr Nasheed was a well-known human rights campaigner and a former political prisoner. In office, he became a vocal figure 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 fresh elections, scheduled for next year. 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.