Image copyright AP Image caption Foreign Minister Mohamed Asim said it was a "difficult but inevitable" decision

The Maldives has withdrawn from the Commonwealth, accusing it of interfering in domestic affairs and "unfair and unjust" treatment.

The Commonwealth had warned the Maldives of possible suspension if it failed to show progress on democracy.

It has faced questions over freedom of speech, the detention of opponents and the independence of the judiciary.

The Indian Ocean nation became a multiparty democracy in 2008 after decades of autocratic rule.

The Maldives foreign ministry said in a statement: "The decision to leave the Commonwealth was difficult, but inevitable.

"Regrettably, the Commonwealth has not recognised progress and achievements that the Maldives accomplished in cultivating a culture of democracy in the country and in building and strengthening democratic institutions."

It said that President Abdulla Yameen's government had introduced a raft of measures promoting human rights and strengthening the rule of law.

Image copyright Getty Images Image caption President Abdulla Yameen has faced protests over his recent legislation

It said the Commonwealth had "sought to become an active participant in the domestic political discourse in the Maldives, which is contrary to the principles of the charters of the UN and the Commonwealth".

The Commonwealth Secretary-General Baroness Scotland said in a statement she was saddened by the Maldives' decision to leave.

She added: "We hope that this will be a temporary separation and that Maldives will feel able to return to the Commonwealth family and all that it represents in due course."

One of the key issues for the Commonwealth was the detention of a number of political leaders, including former President Mohamed Nasheed.

Anti-government protesters have expressed fears they could lose freedoms gained since the first multi-party elections in 2008.

August saw a strict defamation law come into force, with stiff punishments for comments or actions considered insulting to Islam or which "contradict general social norms", and tighter restrictions on demonstrations.

The death penalty is also being reintroduced, after a 60-year unofficial moratorium.

In the past the Commonwealth has suspended some members, including Pakistan, Fiji, Nigeria, and Zimbabwe, over government oppression or violence toward citizens.

No country has formally been expelled but some have withdrawn, including Zimbabwe in 2003 and most recently The Gambia in 2013.

The Maldives is a largely Sunni Muslim nation made up of 1,192 individual islands. It is renowned as a holiday destination for its beaches and luxury resorts.