The speaker of the Maldives parliament has apologised to a British tourist after footage of her arrest by several policemen triggered criticism on social media.

Tourism is a major earner for the Maldives, a tropical archipelago in the Indian Ocean popular with honeymooners and celebrities.

Police said the woman, who was walking on a main road on the island of Maafushi, was “inappropriately” dressed and allegedly unruly and drunk when she was detained after refusing to comply with requests to cover up.

The Maldives once confined tourists to resort islets separate from the local Muslim population but in recent years has allowed foreigners to stay on inhabited islands.

Tourists can wear swimwear such as bikinis in the resorts but are subject to local dress codes elsewhere.

Videos shared on social media showed three men trying to detain the traveller, while a fourth person tried to cover her with a towel.

The woman was heard shouting “you’re sexually assaulting me” during the incident.

The speaker, Mohamed Nasheed, told parliament on Monday that he was extending an apology to the woman over the incident, which saw her detained by police for two hours before being released.

The tourist has since left the nation of 340,000 Sunni Muslims but Nasheed said he hoped tourism authorities would invite her to return.

The Maldives police service commissioner, Mohamed Hameed, wrote after the footage was shared online that the incident “seems to be badly handled”.

Incident in Maafushi in which our officers restrained a female tourist seems to be badly handled. I apologise to the tourist & the public for this. The challenge I have taken up is to professionalise the police service & we are working on that. This matter is being investigated. — Mohamed Hameed (@M_Hameedh) February 6, 2020

“I apologise to the tourist and the public for this. The challenge I have taken up is to professionalise the police service and we are working on that. This matter is being investigated.”

A police statement on Friday called on tourists to respect “cultural sensitivities and local regulations”.

The video of the incident sparked anger among Maldivians. Some took to social media to criticise the tourist’s behaviour after other videos showed her grabbing the sunglasses of a police officer.

A former foreign minister, Dunya Maumoon, criticised both the tourist and the police. “She should have respected the religious and cultural norms of the country in terms of modest attire in a residential area,” Maumoon wrote, but added: “Condemn the man-handling by the Maldivian police. It could have been handled better and more professionally.”