NEW DELHI — The former president of the Maldives has been granted refugee status in Britain, his office said in a statement late Monday, months after he entered the country on medical leave from a 13-year prison sentence on terrorism charges.

The former president, Mohamed Nasheed, the country’s first democratically elected head of state, was jailed for ordering the military to arrest a sitting senior judge, which the court said was an abduction punishable under a section of an antiterrorism law. Mr. Nasheed’s supporters denounced the action as politically motivated, imposed by a government loyal to the longtime leader he had replaced, Maumoon Abdul Gayoom.

Mr. Nasheed and his supporters have been joined by a chorus of countries that have objected to his imprisonment, including Canada, India and the United States. His trial was described as deeply unfair by the United Nations Working Group on Arbitrary Detention, and human rights lawyers, including Amal Clooney, have lobbied for his release.

The Maldives, an archipelago in the Indian Ocean with nearly 400,000 people, has experienced continued turmoil in the months since Mr. Nasheed’s sentencing. The government has ousted or arrested officials whose loyalty to the current president, Abdulla Yameen, Mr. Gayoom’s half brother, has been questioned, and it has cracked down on protest rallies.