Opposition-led protests in the Maldives boiled over on Tuesday with some police officers defying orders to break them up and instead joining in an assault on the military headquarters in the capital Male.

A Reuters witness on Tuesday saw soldiers launch tear gas grenades at a crowd of about 500 people, including several dozen police officers in uniform, who were trying to smash their way into the Maldives National Defence Force (MNDF) headquarters.

The violence on the archipelago best-known as a luxury beach getaway destination is the worst out of more than three weeks of protests.

They started after President Mohamed Nasheed ordered the military to arrest the top criminal court judge, whom he accuses of being in the pocket of former president Maumoon Abdul Gayoom.

That set off a constitutional crisis that has Nasheed, widely credited with ushering in full democracy to the Indian Ocean archipelago with his election victory in 2008, in the unaccustomed position of defending himself of acting like a dictator. Gayoom's 30-year rule was widely seen as autocratic.

Gayoom's opposition Progressive Party of the Maldives accused the military of firing rubber bullets at protesters and spokesman Mohamed Hussain Mundhu Shareef said loads of people were injured. He gave no specifics.

Presidential spokesman Paul Roberts denied the government had used rubber bullets, but confirmed that around three dozen police officers defied orders overnight and smashed up the main rallying point of the ruling Maldivian Democratic Party.

This follows Gayoom's party calling for the overthrow of the Maldives' first democratically elected government and for citizens to launch jihad against the president, Roberts said.

The protests, and the scramble for position ahead of next year's presidential election, have seen parties adopting hardline Islamist rhetoric and accusing Nasheed of being anti-Islamic.

It has also shown the longstanding rivalry between Gayoom and Nasheed, who was jailed for a combined six years after being arrested 27 times by Gayoom's government while agitating for democracy.

(Additional reporting by Ranga Sirilal in Male Writing by Bryson Hull; Editing by Ed Lane)