KUWAIT CITY - A Kuwaiti court freed prominent opposition leader Mussallam al-Barrak on Monday after police fired tear gas and stun grenades to disperse a fifth straight night of demonstrations demanding his release.

Judge Ahmad al-Athari said he was releasing Barrak on a bail of 5,000 dinars ($17,800), triggering jubilation among supporters of the former MP in the small, jampacked courtroom.

The public prosecutor had ordered Barrak be detained for 10 days on Wednesday on charges of insulting the supreme judicial council and slandering its chairman Faisal al-Marshed in a speech he delivered at a public rally last month.

“Oh Mussallam, you are the conscience of the whole nation,” shouted the crowd of supporters after the judge ordered his release.

Barrak’s lawyer Thamer al-Jadaei told AFP his client would be freed from the central jail within hours.

But he has to appear again in court in September to resume the trial for which he faces a maximum of three years in jail.

Elite special forces, backed by armoured vehicles, had earlier escorted Barrak from the city’s central jail to court where supporters rushed to hug him and chanted slogans in his favour.

Around 30 lawyers registered their names to defend Barrak, 58, but the judges allowed only three of them to make arguments.

“What I said at the public rally did not constitute any insult to the judicial council or its chairman,” Barrak told the judge after he read the charges against him.

Wearing a dark brown prison uniform, he said the order to detain him for 10 days “is illegal and is an act of oppression by the public prosecution.”

Barrak told the court that before moving to the central jail, he had been detained at the central investigation department “where the treatment was extremely bad.”

“They did not give me my medicine nor allowed me to eat before fasting” he said, referring to the dawn-to-dusk fast observed by Muslims during the holy month of Ramadan.

Jadaei told the judge that Barrak’s arrest and detention order “were not based on the law and accordingly he must be released by the force of law.”

“We cannot accept in Kuwait that the supreme judicial council becomes a police station,” said Jadaei. The two lawsuits against Barrak were filed by the judicial council and its chairman.

Monday’s ruling comes after five nights of clashes between opposition activists who have been demanding his release and riot police who fired tear gas and stun grenades and arrested more than 50 people.

Riot police on Sunday fired tear gas and stun grenades to disperse hundreds of opposition protesters after they started to march toward a courts complex in the capital Kuwait City, forcing them to flee.

The interior ministry said a number of protesters had been held while rights activist Mohammad al-Humaidi said around 30 people were arrested.

Activists said a number of protesters were wounded with at least one of them hospitalised.

They also announced they would keep protesting until all those arrested were released.

Emir Sheikh Sabah al-Ahmad Al-Sabah discussed the violence on Sunday with his crown prince and prime minister.

At a public rally last month, Barrak alleged that former senior officials, including ruling family members, had stolen tens of billions of dollars from public funds and engaged in money-laundering.

He also criticised the judiciary.

The scandal was later linked to claims that the same officials were seen in video footage plotting a coup.

Those allegations were made in a lawsuit filed last month by Sheikh Ahmad Fahad Al-Sabah, a senior ruling family member and former energy minister.

Sheikh Ahmad was himself questioned as a witness.

Most opposition groups are not represented in parliament after boycotting a July 2013 election in protest at Kuwait’s amended electoral law.