Hundreds of mourners have attended a vigil in a northeastern Thai city for the victims of the worst mass shooting in the country's modern history.

People in Nakhon Ratchasima city on Sunday lit candles, laid down flowers and chanted by the statue of a historic local heroine, Thao Suranari, as Buddhist monks led prayers for the 29 people killed and the 57 wounded.

More:

The gunman, identified as 32-year-old rogue soldier Jakrapanth Thomma, went on a shooting spree late on Saturday, firing bullets at various locations around the city of before holing himself up at the Terminal 21 shopping centre.

The 17-hour ordeal, which included several gun battles and dashes for the exits by frightened shoppers, ended on Sunday morning when the security teams shot the attacker dead.

Officials said the gunman was angry over a financial dispute with his commanding officer, whom he made his first victim before stealing guns from an army camp. He then headed to the shopping centre, where he opened fire indiscriminately at people inside and outside the complex.

People depose flowers to commemorate 29 people who died in Thailand's deadliest mass shooting. [Chaline Thirasupa/AFP]

Among the victims were a mother killed at the wheel of her car; members of the security forces going after the gunman; and Rachanon Kanchanamethi, a 13-year-old boy who shot as he was riding his motorbike.

"I don't want to lose him like this," the boy's father, Nuttawut Kanchanamethi, told The Associated Press news agency.

"This is too sudden. We had plans for him, growing up. That's all. We didn't impose any expectations on him."

Nuttawut paused for a long moment.

"I want to continue taking care of him, but I no longer have that opportunity," he said, breaking into sobs.

'Remember forever'

Those who attended the sombre vigil pointed their fingers to the sky as a symbol that their prayers would lead the souls of the dead to heaven. Others scrawled condolence messages on white sheets of paper laid out on the ground, including "Remember Forever" and "I wish you a good afterlife".

"You have this rage, it fills you," local resident Chirathip Kurapakorn told Reuters News Agency at the vigil.

"I have two kids of my own and just thinking about those lives in there. I could not sleep at all last night. I was just trying to get the right news and just wanted to help somehow, but I just could not."

"It just happened right here in our hometown behind us, like right in our heart of everything. It's just tragic," Pacharida Sangthongsuk said.

Users on social media also expressed their sorrow.

"Told me not to cry when you were gone. But the feeling is overwhelming, it's too much strong".

Told me not to cry

when you were gone

But the feeling's

overwhelming, it's much too strong. #PrayForKorat #กราดยิงที่โคราช pic.twitter.com/UMYzuLKtdz — ~ฉันคือชะนี..ที่แอบรักเก้ง💞~Shipper เฮ!! (@Sawetkralin) February 9, 2020

Earlier in the day, Prime Minister Prayuth Chan-ocha visited a hospital where the wounded were being treated.

"It is unprecedented in Thailand, and I want this to be the last time this crisis happens," he said outside the hospital.

"I hope this is the only one and the last incident and that it never happens again. No one wants this to happen. It could be because of this person's mental health in this particular moment."