Police and military have swarmed a Thai shopping centre where a soldier who went on a deadly shooting rampage across the city is holed up on Sunday morning (Australian time).
The Thai soldier earlier shot dead his commanding officer at an army base before stealing weapons and embarking on a massacre across the city of Nakhon Ratchasima, northeast of Bangkok.
Authorities confirmed 20 people were killed and 31 injured as the rogue officer opened fire at various locations including the military base and numerous sites en route to the Terminal 21 shopping mall in the city centre.
The shooter identified as Jakrapanth Thomma is on Sunday morning at large inside the multi-storey complex were it was unknown whether he had taken hostages.
A group of armed commando soldiers are seen outside Terminal 21 Korat mall, in Nakhon Ratchasima.
He had earlier driven a Humvee-type vehicle from the army base to the city centre, opening fire at various sites along the way.
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 as Thai police and soldiers sealed off the centre while the suspect remains at large.
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.
Thai rescue workers tend to victims of a soldier who "went mad" and killed 20 people. Photo: AAP
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.