Updated

The first democratically elected president of the Maldives resigned Tuesday after the police and army clashed in the streets of the island nation amid protests over his controversial arrest of a top judge.

The resignation marked a stunning fall for President Mohamed 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 governments to combat the climate change that could raise sea levels and inundate his archipelago nation.

Nasheed presented his resignation in a nationally televised address Tuesday afternoon after police joined the protesters and then clashed with soldiers in the streets. Some of the soldiers then defected to the police side.

"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, who previously worked for the United Nations, including as the head of its children's fund in Afghanistan.

Hassan's office denied widespread reports that the military pressured Nasheed to resign in the wake of the clashes.

"It was not a coup at all, it was the wish of the people," said Ahmed Thoufeeg, Hassan's secretary. He said Hassan was to be sworn in later Tuesday.

The latest protests in this Indian Ocean nation known for its lavish beach resorts erupted after Nasheed ordered the military to arrest Abdulla Mohamed, the chief judge of the Criminal Court. The judge had ordered the release of a government critic he said had been illegally detained.

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.

Nasheed began his term with great hopes, ending Maumoon Abdul Gayoom's 30-year-reign by winning the country's first democratic elections in 2008. Supporters danced and cheered in the streets at the victory of the charismatic pro-democracy activist, who had been repeatedly jailed by Gayoom's regime.

Nasheed became an energetic global environmental crusader, founding the Climate Vulnerable Forum, to coordinate environmental policy among a group of about 30 countries most affected by climate change.

He held a Cabinet meeting underwater in scuba gear to dramatize the threat of rising oceans to his low-lying archipelago nation of 300,000 people, and said he may need to relocate his entire population if nothing was done. He also announced plans to make his nation "carbon-neutral," using wind and solar projects.

A documentary on his efforts, "The Island President," won awards at the Sundance and Toronto film festivals and is slated to open next month in New York.

But over the past year, Nasheed was battered by protests in his Sunni Muslim nation.

Maldivians demonstrated against soaring prices they blamed on economic reforms he said were needed to bridge the budget deficit. Islamic activists also protested in demand of more religiously conservative policies.

As the protests grew, there were disturbing signs the one-time rights activist was changing.

Police routinely cracked down on opposition protests, while letting government supporters gather freely. For many, the judge's arrest was the final straw.

Mohamed is still in military custody.