Media playback is unsupported on your device Media caption Gunshots can be heard and people can be seen running through the shopping centre

A soldier has killed 21 people and injured dozens more in a gun rampage in the Thai city of Nakhon Ratchasima.

Jakraphanth Thomma on Saturday killed his commanding officer before stealing weapons from a military camp.

The suspect continued his attack in a shopping centre, where he is still believed to be holed up, initially posting updates on his social media.

Security forces are in the complex and have rescued hundreds while searching for the gunman, with shots ringing out.

The gunman's motives remain unclear.

What is the situation now?

The Terminal 21 shopping centre in Nakhon Ratchasima, also known as Korat, remains sealed off on Sunday.

Image copyright Reuters Image caption Thai security forces on Sunday evacuated more people from the Terminal 21 shopping centre

Shortly after 03:00 local time (20:00 GMT Saturday) gunfire was heard as the security forces raided the building, trying to dislodge the gunman.

One member of the security forces was killed and two injured.

Several people were led out of the centre, but it is not known how many more people are still trapped inside.

Earlier reports said the gunman had tried to escape via the back of the building.

Image copyright Facebook Image caption Suspect Jakraphanth Thomma is said to be holed up in the shopping centre

The Bangkok Post reported earlier that the suspect, who it said was 32 years old, had taken hostages, but this also has not been officially confirmed.

The suspect's mother was also brought to the shopping centre to try to persuade him to give himself up.

Image copyright AFP/THAI ROYAL POLICE Image caption Security forces evacuate people from the shopping complex

Image copyright AFP Image caption People described hiding under tables in the shopping centre before they managed to flee

One of the people freed told the BBC how she and others hid in a bathroom on the fourth floor, before fleeing to the second and hiding under a restaurant table for three hours, hearing at least four gunshots before she saw some soldiers and could get to safety.

Public Health Minister Anutin Charnvirakul earlier said that 16 people had died at the scene of the shootings, with another four dying later in hospital.

A total of 31 people have been injured, with 10 of them in a critical condition. But there are fears the numbers could rise.

How did the attack unfold?

It began at about 15:30 local time on Saturday (08:30 GMT) at the Suatham Phithak military camp, where the commanding officer, named by the Bangkok Post as Col Anantharot Krasae, was killed.

The Post said a 63-year-old woman, Col Anantharot's mother-in-law, and another soldier were also killed there.

The suspect seized arms and ammunition from the camp before taking a Humvee-type vehicle.

He then opened fire at a number of sites before arriving at Terminal 21 at about 18:00 local time (11:00 GMT).

Local media footage appeared to show the suspect getting out of his vehicle and firing shots as people fled.

CCTV footage showed him inside the shopping centre with a raised rifle.

Image copyright EPA Image caption Armed soldiers are standing guard around the shopping centre

Other footage showed a fire outside the building, with some reports saying it was caused by a gas canister that exploded when it was hit with a bullet. One of the suspect's social media posts featured an image of himself with the fire in the background.

Prime Minister Prayuth Chan-ocha is following developments and expressed condolences to the families of those killed, a spokeswoman said.

The public health minister has put out an appeal for people to donate blood at hospitals in the area.

Image copyright AFP Image caption Thai police put a wanted poster on their Facebook page

What did the suspect post on social media?

He posted on his social media accounts during the attack, with one post on Facebook asking whether he should surrender.

He had earlier posted an image of a pistol with three sets of bullets, along with the words "it is time to get excited" and "nobody can avoid death".

Facebook has now taken the page down.

It said: "Our hearts go out to the victims, their families and the community affected by this tragedy in Thailand. There is no place on Facebook for people who commit this kind of atrocity, nor do we allow people to praise or support this attack."