The gunman, identified by police as Sergeant Major Jakrapanth Thomma, stole an army vehicle and also posted photos and video of himself in full tactical gear.
A soldier who holed up in a popular shopping mall in northeastern Thailand shot multiple people on Saturday, killing at least 20 and injuring 31 others, officials said.
Police said they have secured the mall, and Public Health Minister Anutin Charnvirakul said there were no more bodies left inside. But he added, "we don't know whether there are any additional injuries or deaths or not." He did not say whether the shooter had been found.
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 kilometres (155 miles) from capital Bangkok, police spokesman Kissana Phathanacharoen said in a message sent to reporters.
The shooter remained close to a shopping mall and had not yet been apprehended, the police said.
"We don't know why he did this. It appears he went mad," said defence ministry spokesman Kongcheep Tantrawanit.
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.
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.
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.