The Maldives’ first freely elected president has resigned after what his party called a “coup d’etat” orchestrated by opposition leaders with the backing of security forces.

Within hours of Mohamed Nasheed stepping down on Tuesday, his deputy – who is from a different party – was sworn in to replace him, promising to uphold the “rule of law”.

“It will be better for the country in the current situation if I resign,” Nasheed had told a televised news conference. “I don’t want to run the country with an iron fist. I am resigning.”

His announcement followed a police mutiny that capped three weeks of anti-government demonstrations in the Indian Ocean island nation against what activists saw as Nasheed’s “unconstitutional” arrest of a senior judge.

““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.” – A statement from Nasheed’s party

In a series of statements released publicly and to foreign diplomatic missions, Nasheed’s Maldives Democratic Party (MDP) said the president’s resignation was “involuntary” and that he had been effectively overthrown.

“We strongly condemn the coup d’etat that has been brought against the constitutionally elected government,” the party said.

It said the president had been taken to his office “under the custody of the security forces” and forced to announce he was stepping down.

Nasheed spent the afternoon following his declaration in his official residence before being escorted by armed guards to a family home where he spent the evening, his brother Nazim Sattar said.

Mohamed Waheed, who as vice president had clashed with Nasheed over the chief justice’s detention, was sworn in as the new head of state.

He urged the population of 300,000 Sunni Muslims to remain calm and said no acts of “revenge” should be taken against members of Nasheed’s government.

Police mutiny

The dramatic day of unrest began in the early hours when a group of policemen – estimated at from several dozen to several hundred strong – refused orders to break up an anti-government protest in the capital Male.

Maldives Quick Facts

The nation of the Maldives is a grouping of 1,192 islands covering about 500 miles of the Indian Ocean, south of India. Fewer than 200 of the islands are inhabited. 330,000 people are citizens, including 200,000 on the capital island of Male alone. The Maldives gained independence from Britain in 1965. Most of the population is Muslim, which has greatly influenced the political system. Tourism is the largest industry, accounting for a third of GDP and more than 60 per cent of foreign currency earnings. GDP in 2009 was $47bn. GDP per capita was $2,791.80. Source: Agencies

The MDP said members of the armed forces had joined the protesters’ ranks at the behest of senior opposition leaders loyal to former president Maumoon Abdul Gayoom.

Gayoom, who had ruled the Maldives for 30 years, was ousted by Nasheed in the country’s first democratic elections in 2008.

“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.

“These police and army personnel ignoring the chain of command, moved around the capital in full riot gear, attacking MDP headquarters,” it said.

Colonel Abdul Raheem Abdul Latheef, an army spokesperson, categorically denied that any coup had taken place, saying that Nasheed had sought the army’s advice and was told that resignation was probably the best option.

It was a spectacular fall for Nasheed, a 44-year-old media-savvy father of two daughters, who rose to power from grassroots political opposition to the autocratic Gayoom regime which imprisoned him on several occasions.

He formed the MDP in exile before returning home to a hero’s welcome, sweeping 54 per cent of the vote in the 2008 polls and going on to build an international reputation as a campaigner against climate change, highlighting the Maldives’ vulnerablity to rising sea levels.

The unrest has also seen demonstrations by Islamic hardliners against the government, particularly over the transport ministry’s decision to allow direct flights from Israel.

Large crowds gathered outside the president’s office after his resignation announcement, but residents said the streets had largely cleared by evening.

Ahmed Shiyam, a police spokesperson, said by telephone that “anyone from the previous regime who worked against the constitution and laws” would not be allowed to leave the country.

The Maldives, a nation of almost 1,200 islands scattered across the equator, is dependent on tourism and is famous for its upmarket holiday resorts and hotels that cater to honeymooning couples and high-end travellers.

Regional power India, which intervened with troops to prevent a coup in 1988, said the resignation was “an internal matter”, adding that it hoped “all issues will be resolved in a peaceful and democratic manner”.