A soldier who killed 20 people in a gun rampage in the Thai city of Nakhon Ratchasima has been shot dead by the security forces, Thai police say.
Jakraphanth Thomma on Saturday killed his commanding officer before stealing weapons from a military camp.
The suspect continued his attack in a shopping centre in Nakhon Ratchasima, also known as Korat.
He posted material to social media, but his motives for his actions remain unclear.
Public Health Minister Anutin Charnvirakul posted on his Facebook page on Sunday morning, congratulating the security forces for their actions in the northeastern Thai town.
“Thank you police and army for ending the situation. Shooter shot dead!!!”
Officials said that the death toll stood at 20, with 42 wounded, revising an earlier total of 21 dead. However, it is still possible that the number of fatalities could rise.
Shortly after 03:00 local time (20:00 GMT Saturday) gunfire was heard as the security forces raided the building, trying to dislodge the gunman.
One member of the security forces was killed and two injured.
Several people were led out of the centre, but there were concerns that more people were being held hostage.
READ ALSO: BREAKING: Thai Soldier kills ‘Many’ In Shooting Rampage
At 09:30 (02:30 GMT) on Sunday, police confirmed that the gunman had been shot dead, but so far there are no more details about how the operation concluded.
Earlier reports said the gunman, aged 32, had tried to escape via the back of the building.
The suspect’s mother was also brought to the shopping centre to try to persuade him to give himself up.
One of the people freed told the BBC how she and others hid in a bathroom on the fourth floor, before fleeing to the second and hiding under a restaurant table for three hours, hearing at least four gunshots before she saw some soldiers and could get to safety.
The Saga began at about 15:30 local time on Saturday (08:30 GMT) at the Suatham Phithak military camp, where the commanding officer, named by the Bangkok Post as Col Anantharot Krasae, was killed.
The Post said a 63-year-old woman, Col Anantharot’s mother-in-law, and another soldier were also killed there.
The suspect seized arms and ammunition from the camp before taking a Humvee-type vehicle.
He then opened fire at a number of sites before arriving at Terminal 21 at about 18:00 local time (11:00 GMT).
Local media footage appeared to show the suspect getting out of his vehicle and firing shots as people fled.
CCTV footage showed him inside the shopping centre with a raised rifle.
He posted on his social media accounts during the attack, with one post on Facebook asking whether he should surrender.
He had earlier posted an image of a pistol with three sets of bullets, along with the words “it is time to get excited” and “nobody can avoid death”.
Facebook has now taken the page down.