A Thai soldier shot dead his commanding officer at an army base before stealing weapons and embarking on a massacre across the city of Nakhon Ratchasima.
Authorities confirmed 20 people have been killed and 31 injured as the rogue officer opened fire at various locations including the military base, a shopping centre and numerous sites between the two.
The shooter identified as Jakrapanth Thomma was on Sunday morning holed up inside the Terminal 21 shopping mall were it's unknown whether he has taken people hostage.
He had earlier driven a Humvee-type vehicle from the army base to the city centre, opening fire at various sites en route.
More shots were fired when he arrived at the busy shopping centre where more people were killed as hundreds of shoppers and workers fled in panic or found places to hide.
There are believed to be dozens of people still trapped inside the complex where the gunman has been holed up on Sunday morning as Thai police and soldiers stormed the centre.
The massacre mayhem was initially being streamed on Facebook live before it was shutdown.
Thai media are reporting the killer's mother has been brought to the scene outside the mall in a bid to persuade him to surrender.
A video showed her in tears saying "Why did he do it?" as she got into a police vehicle.
Major shootings are rare in the Southeast Asian country other than in the far south, where a decades-old insurgency persists.
The city is about 250km northeast of the capital Bangkok.
"We don't know why he did this. It appears he went mad," said defence ministry spokesman Kongcheep Tantrawanit.
The suspect had posted on his Facebook page earlier in the day that "Death is inevitable for everyone".
He also posted a picture of what appeared to be his hand holding a gun.
At one point after the shooting had begun, the suspect posted "Should I give up?" before his account became inaccessible.
Local media showed footage of the soldier getting out of a car in front of a shopping mall and firing a series of shots, sending people running.
Gunshots could be heard on the video.
Later video on social media from CCTV footage inside the mall showed the gunman dressed in black and wearing a mask.
He slung his gun over his shoulder as he moved into an electronics store with no sign of other people around.
Facebook sent its condolences to the victims and their families and said there was no place on Facebook for anyone who commits or supports such atrocities.
"We have removed the gunman's accounts from our services and will work around the clock to remove any violating content related to this attack as soon as we become aware of it," it said.
A woman interviewed by Thailand's Channel One television said she had heard gunshots when she was at the shopping mall and hid in a clothing store with other people before escaping.
The shooter had initially gone to a house in the city and shot two people dead, before going to the weapons store on an army base and taking a new gun, local police said.
He also shot at people on the army base, they said.