Nasheed presented his resignation in a nationally televised address Tuesday afternoon after police joined the protesters and then clashed with soldiers in the streets.
"I don't want to hurt any Maldivian. I feel my staying on in power will only increase the problems, and it will hurt our citizens," Nasheed said. "So the best option available to me is to step down."
Nasheed was expected to hand over power to Vice President Mohammed Waheed Hassan.
The resignation came after weeks of protests in this Indian Ocean island nation known more for its lavish beach resorts than political turmoil.
It marked a stunning crash for Nasheed, a former human rights campaigner who defeated the nation's longtime ruler in the country's first multiparty election. Nasheed was also an environmental celebrity, traveling the world to persuade government's to combat the climate change that could send sea levels rising and inundate his archipelago nation.
Nasheed fell out of public favor after he ordered the military to arrest Abdulla Mohamed, the chief judge of the Criminal Court.
The arrest came after the judge ordered the release of a government critic, calling his arrest illegal.
The vice president, Supreme Court, Human Rights Commission, Judicial Services Commission and the office of the United Nations High Commissioner for Human Rights have all called for Mohamed to be released.
The government accused the judge of political bias and corruption. It said that the country's judicial system had failed and called on the U.N to help solve the crisis.
After weeks of protests, the crisis came to a head Tuesday when hundreds of police started demonstrating in the capital, Male, after officials ordered them to withdraw protection for government and opposition supporters protesting close to each other. The withdrawal resulted in a clash that injured at least three people.
Later, troops fired rubber bullets and clashed with the police. When Nasheed visited the police and urged them to end the protest, they refused and instead chanted for his resignation.
The Maldives, an archipelago nation of 300,000 people, is a fresh democracy, with 30 years of autocratic rule ending when Nasheed was elected in 2008. Nasheed is a former pro-democracy political prisoner.
Hassan, the vice president, has previously worked for the United Nations, including as the head of its children's fund in Afghanistan.