Thai soldier
A person runs away during a Thai soldier's shooting rampage in the city of Nakhon Ratchasima, Thailand February 8, 2020
A Thai soldier has killed at least 30 people in a mass shooting and injured 58 before taking hostages inside a shopping mall while taking selfies and livestreaming on social media.

The man, who police identified as a junior army officer, opened fire in a shopping center in Korat, also known as Nakhon Ratchasima, in northeast Thailand. Before the attack he killed his commander and two others, stole weapons and ammunition and fled in a stolen Humvee.

Terminal 21 mall was full of Saturday shoppers when the attack occurred. A video posted to social media show people running inside the building and fleeing outside as multiple shots are fired.

In another clip, a large fire burns near the building.The attacker fired at a cooking gas cylinder, according to the Bangkok Post.

The gunman took hostages on the fourth floor of the mall while many people were still stuck inside. Police urged them to to hide in a safe place and to mute their mobile phones.

Before midnight, police said the mall had been secured, but apparently the gunman was not apprehended.

Gunshots were heard after police in special gear entered the building. More people were seen fleeing outside at night. One special forces serviceman was killed and another injured during the shooting overnight, Thairath TV reports.

Local media have reported that the shooter took selfies and livestreamed during the attack. One of the purported photos shows the suspect wearing a combat helmet and a face mask as he holds up an assault rifle.

Social media users posted what appear to be short clips of a livestream, with the suspect panning the camera to show the area around him. The gunman reportedly posted status updates on Facebook during his rampage, including "Should I surrender (give up)?" and "Well I stopped already." Before carrying out the attacks, he posted an image of a pistol with bullets, captioning the photo: "It's time to get excited."

It's not clear whether the attacker began shooting at people before he entered the building or not, but one video posted on Twitter appears to show a man sheltering behind a car door which looks like it has been covered in blood.

More footage apparently recorded from security cameras inside the mall shows the masked man walking in an empty area with an assault rifle in his hand.

The Thai army asked local media to cease their live coverage to avoid giving the shooter updates on their plans, the Bangkok Post reported.

The gunman's Facebook page was shut down when he began live streaming the attack, but some reports said that he had previously left the message "Death is inevitable for everyone" on the page earlier in the day.

Thai police have identified a shooter who killed at least 30 people, injured 58 others and held hostages at a shopping mall in Thailand as junior army officer Jakraphanth Thomma.

"We don't know why he did this. It appears he went mad," Defence Ministry spokesman Kongcheep Tantrawanit said as police confirmed that Thomma killed his commanding officer before stealing weapons from a military base and going on the shooting rampage.

Thai police posted a wanted poster for Thomma on their social media pages, warning people stuck inside the mall to hide in a safe place and to mute their mobile phones.

Shortly before midnight, police said that they had secured the mall. The authorities reportedly brought in his mother to help negotiate surrender.