Thai security forces have killed a soldier who shot dead at least 26 people during a brutal rampage on Saturday.
Police and military personnel stormed the Terminal 21 shopping centre in the north-western city of Nakhon Ratchasima to face suspected gunman Sergeant Jakrapanth Thomma.
Officials said the soldier, who has been confirmed dead, was angry over a land deal.
His death brought an end to an hours-long stand-off at the centre - during which automatic gunfire was heard and one security officer died, with two others wounded.
Further gunfire and explosions were heard inside the mall after the death of the security officer was confirmed.
The Irish embassy in Bangkok has expressed "very sincere condolences to the victims and their families" on Twitter.
Our very sincere condolences to the victims and their families and to the people of Thailand following the sad and distressing loss of lives in Korat city.
— Irish Embassy Thailand (@IrlEmbThailand) February 9, 2020
The death of Thomma takes the total death toll related to the rampage to 26, while at least 57 people are injured.
Thai authorities do not believe there are any more bodies inside the mall, which shoppers were evacuated from.
Thomma appeared to be armed with an assault rifle, based on security camera video aired on Thai Rath television.
Several Thai media outlets reported that he travelled to the mall in a military vehicle.
Dozens of people were seen running from the building, fleeing in groups with some carrying children and others supporting elderly people by carrying them with one person on each side.
Authorities say they got reports that Thomma's rampage had begun at around 3.30pm local time.
Police announced they had secured the mall more than eight hours later.
The gunman initially went to a house in the city, which is more than 250km from Bangkok, and shot two people dead before going to a weapons store on an army base and taking a new gun, local police said.
Earlier in the day, he posted on his Facebook page that: "Death is inevitable for everyone."
At one point after the shooting had begun, he wrote: "Should I give up?"
Facebook said on Saturday that it had removed the account, saying: "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."
The soldier opened fire at different locations in the city, police spokesman Kissana Phathanacharoen said in a message to reporters.
He then drove past a school towards the Terminal 21 shopping centre and continued his shooting spree.
It was shut down and the street outside closed.
Video taken outside the shopping centre and shared on social media showed people taking cover in a car park as gunshots were fired.
A woman interviewed by Thailand's Channel One television said when she heard gunshots she hid in a clothing store with other people before managing to escape.
Another woman who filmed a video from outside the centre said she had just left the building after finishing her meal.
"While we were in our car on the opposite side, we heard a loud sound and then we could see people starting to run out", said Nattaya Nganiem.
She added: "First I saw a woman run out from the mall hysterically. Then a motorcycle rider in front of her just ran and left his motorcycle there.
"I thought, what's happening? Then we heard several gunshots.
"The motorcycle guy probably had seen the gunman from where he was. We couldn't see him, but we could hear the sound of the gun. It was terrifying.
"We were just inside having dinner and my child was getting unusually restless, that's why we left, otherwise, we would have been stuck inside there.
"I can't believe this is happening in my hometown. I mean, this shopping mall, we go there almost every other day."
Unconfirmed victims include police and a motorbike taxi driver who tried to stop him.
A police officer said the suspect had been involved in an argument about a land deal and shot two people who were involved - another soldier and a woman.
He said a third person was injured.