A Thai judge shot himself in the chest in front of a packed court after acquitting several murder suspects and decrying the kingdom's judicial system in an impassioned speech broadcast on Facebook Live.
Critics say Thailand's courts often work in favour of the rich and powerful, while delivering swift and harsh sentences on ordinary people for minor offences.
But it is virtually unheard of for judges to criticise the system.
Kanakorn Pianchana, a judge at Yala court in the heart of the insurgency-battered Thai south, was delivering the verdict for five Muslim suspects in a gun murder case on Friday afternoon.
He acquitted the group, delivered a courtroom plea for a cleaner justice system, before pulling out a handgun and shooting himself in the chest.
"You need clear and credible evidence to punish someone. So, if you're not sure, don't punish them," the judge said addressing the court and broadcasting his words on his phone on Facebook live.
"I'm not saying that the five defendants didn't commit the crimes, they might have done so...
"But the judicial process needs to be transparent and credible... punishing wrong people makes them scapegoats."
The Facebook feed then cut, but witnesses said Kanakorn recited a legal oath in front of the former Thai king's portrait, before shooting himself in the chest.
"He is being treated by the doctors and is out of danger," Suriyan Hongvilai, the spokesman of the Office of the Judiciary, said on Saturday.
"He shot himself because of 'personal stress'. But the cause behind the stress is not clear and will be investigated," he said.
No Thai judge has ever breached protocol by making similar statements on the wider justice system, he added.
A lawyer working with the suspects said Judge Kanakorn had ruled the prosecutor's evidence was insufficient to convict.
"Right now the five are still being detained and are waiting to see if the state prosecutor appeals their acquittal," Abdulloh Hayee-abu, of the Muslim Attorney Centre in Yala said.
Over 7,000 people have died in 15 years of conflict in the Malay-Muslim majority southern region.
Thousands of suspects have been jailed for acts linked to the insurgency, many under emergency laws imposed on the restive region.
Advocacy groups in the Thai south have long accused security forces of trumping up charges against Muslim suspects and using emergency laws to drive cases through the courts. - AFP