A Thai soldier who killed at least 26 people before being shot dead in a mall by commandos went on the rampage because of a debt dispute, the kingdom's premier said Sunday, offering the first official speculation for the motive of an "unprecedented" shooting spree.After a night which seesawed between heavy exchanges of gunfire and terrifying dashes for mall exits by trapped shoppers, sharp-shooters brought an end to the 17-hour-ordeal when they killed the gunman on Sunday morning in Nakhon Ratchasima, also known as Korat.Twenty-six people including civilians - the youngest a 13-year-old boy - and security forces were killed by the rogue soldier, Thailand's prime minister Prayut Chan-O-Cha said."It is unprecedented in Thailand, and I want this to be the last time this crisis happens," he said outside a hospital where victims, including at least two undergoing brain surgery, were being treated.Prayut, a gruff former army chief, blamed a "personal problem" over the sale of the house for the soldier's rampage, which began on Saturday afternoon near an army barracks and was for several hours relayed by the gunman via Facebook posts.'People guarding it'The attacker, a junior army officer identified as Sergeant-Major Jakrapanth Thomma, used a stolen M60 machine gun, rifles and ammunition from one of Thailand's largest barracks as well as a military Humvee to carry out the attack.Prayut said he overpowered security at the barracks' arsenal."This was not carelessness. We don't leave the arsenal depot alone - we had people guarding it."Most of the dead were killed in an around the mall.Volleys of gunfire rang out as the siege ran into dawn, hours after Thai security services stormed the ground floor and freed scores of stunned, terrified shoppers from a bloody rampage.Frightened shoppers sent cascades of messages to friends and family on social media from cupboards, toilets and under tables as the gunman stalked the mall.Shocked evacuees recounted how an ordinary Saturday at the busy shopping centre descended into horror as the gunman entered, sparking an hours' long ordeal."It was like a dream... I'm grateful I survived," Sottiyanee Unchalee, 48, told AFP, explaining she hid in the toilet of a gym inside the mall as she heard the gunfire.A Filipina teacher Aldrin Baliquing said he was ushered into a storeroom by staff as the shooting began."We were there for six gruelling hours... I'm in shock," she said.Heavy gunfireScores of people made a dash for it as police and soldiers in masks and wielding assault rifles took control of the ground floor following a gun battle and scoured the fleeing crowds for the assailant.Hours later he was shot dead. Photos showed smiling elite units of soldiers and police emerging from the mall.Purported video from the scene - shared on social media - showed snipers in webbing on elevated walkways, aiming their rifles downwards as heavy gunfire echoed across a concourse below.The gunman relayed his shooting spree through Facebook posts which charted the attack from an army barracks to the city mall.Despite the prime minister's speculation Jakrapanth's exact motive remained unclear as Korat - a sedate and mid-size town - tried to digest the scale of the atrocity.The bloodshed began on Saturday afternoon when he shot three people - among them at least one soldier - at a senior officer's house and then at the nearby army barracks, before driving a military vehicle to the town centre.There the gunman used the stolen weapons to unleash carnage in the town centre.