A Thai soldier killed at least 20 people in a shooting rampage on Saturday in the city of Nakhon Ratchasima in the northeast of Thailand, defence ministry spokesman Kongcheep Tantrawanit told Reuters.
Kongcheep did not give a figure for the number of wounded. He said it was unclear whether the gunman had taken hostages inside the shopping mall, where he is still thought to be at large.
Major shootings are rare in the Southeast Asian country other than in the far south, where a decades-old insurgency persists.
"We don't know why he did this. It appears he went mad," said defence ministry spokesman Kongcheep Tantrawanit.
Police identified the suspect as Jakrapanth Thomma. He 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.
The soldier opened fire at different locations in the city, which is more than 250 km (155 miles) from the capital Bangkok, the police spokesman said.
The shooter was still in the Century 21 shopping mall and had not yet been apprehended, the police said.
Thai media said the suspect's mother was being brought to the location to try to persuade him to give himself up. A video showed her in tears saying "why did he do it?" as she got into a police vehicle.
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.
One video from a bystander showed a man slumped at the wheel of a car in a pool of blood. It was unclear if he was among the dead. Another video showed at least four people who had clearly been shot and showed no sign of movement.
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.
Hashtags #KoratShootingRampage and #SaveKorat were trending on social media in Thailand.
Public Health Minister Anutin Charnvirakul asked on his Facebook page for blood donations at four hospitals in the vicinity of Korat.
Thai army chief Apirat Kongsompong issued an order for local army commanders to rush to the scene and investigate.
Prime Minister Prayuth Chan-ocha expressed condolences to the families of those killed, a government spokeswoman said.
Nakhon Ratchasima is one of the biggest cities in northeastern Thailand, a rice growing area and one of the poorest regions in the country of 69 million.