A Thai soldier killed two people and wounded one other in a shooting at a military facility in Bangkok on Wednesday, police and army officials said.
Sergeant Major Yongyuth Mungkornkim, a clerk at the Royal Thai Army War College, shot three other soldiers around 8:45 am (0145 GMT), the military said in a statement.
The 59-year-old tried to flee the scene but surrendered himself around 10 am, deputy national police spokesman Kissana Phathanacharoen told reporters.
"The army would like to offer condolences to the families of the deceased soldiers and the wounded. This incident was a loss for both the families and organisation. It is something that wasn't expected to happen," deputy army spokesperson Senior Colonel Sirichan Nga-thong said in a statement.
"The cause and motivation for the incident is under investigation."
In the aftermath of the shooting, police officers and soldiers guarded the gates of the facility, part of a large complex of military buildings in the north of the capital.
The military statement named the victims as Sergeant Major Nopparat Inthasunthorn and Sergeant Major Prakarn Sinsong.
The third soldier, Sergeant Major Yongyuth Panyanuwat, was taken to hospital for treatment, the statement said.
Acting Prime Minister Prawit Wongsuwan told reporters that police were investigating but it was too early to be sure of the shooter's motives.
The suspect's mental health is being assessed as part of the probe, police said. Initial reports suggested the weapon used was a 9mm pistol.
While Thailand has high rates of gun ownership, mass shootings are extremely rare.
But in the past year, there have been at least two other cases of shooting murders by serving soldiers, according to the Bangkok Post.
And in 2020, in one of the kingdom's deadliest incidents in recent years, a soldier gunned down 29 people in a 17-hour rampage and wounded scores more before he was shot dead by commandos.
That mass shooting, which shocked Thailand, was linked to a debt dispute between gunman Sergeant-Major Jakrapanth Thomma and a senior officer, and the military top brass were at pains to portray the killer as a rogue soldier.
The military has powerful influence in many aspects of life in Thailand from politics to business, and has intervened to seize power numerous times over the decades, most recently in 2014.
Police cars parked outside the gates after an alleged shooter was detained in the Army Training Command in Bangkok. AFP