WARNING: This article contains graphic images and detail
A former police officer facing a drugs charge burst into a daycare centre in Thailand, killing dozens of preschoolers and teachers and then shooting more people as he fled.
At least 36 people were slain in the deadliest rampage in the nation's history.
The assailant, who was fired earlier this year, took his own life after killing his wife and child at home.
Photos taken by first responders showed the school's floor littered with the tiny bodies of children still on their blankets, where they had been taking an afternoon nap. The images showed slashes to their faces and gunshots to their heads and pools of blood.
A teacher told ThaiPBS public broadcaster that the assailant got out of a car and immediately shot a man eating lunch outside, then fired more shots. When the attacker paused to reload, the teacher had an opportunity to run inside.
"I ran to the back, the children were asleep," said the young woman, who did not give her name, choking back her words. "The children were 2 or 3 years old."
The attack took place in the rural town of Nongbua Lamphu in northeastern Thailand, in one of the country's poorest regions.
Another witness said staff at the daycare had locked the door, but the suspect shot his way in.
"The teacher who died, she had a child in her arms," the witness, whose name wasn't given, told Thailand's Kom Chad Luek television. "I didn't think he would kill children, but he shot at the door and shot right through it."
At least 10 people were wounded, including six critically, police spokesman Archayon Kraithong said.
A video taken by a first responder arriving at the scene showed rescuers rushing into the single-story building past a shattered glass front door, with drops of blood visible on the ground in the entryway.
In footage posted online after the attack, frantic family members could be heard weeping outside the building. One image showed the floor smeared with blood where sleeping mats were scattered around the room. Pictures of the alphabet and other colourful decorations adorned the walls.
Police identified the suspect as 34-year-old former police officer Panya Kamrap. Police Major General Paisal Luesomboon told PPTV in an interview that he was fired from the force earlier this year because of the drugs charge.
In a Facebook posting, Thai police chief General Dumrongsak Kittiprapas said the man, who had been a sergeant, was due in court Friday for a hearing in the case involving methamphetamine, and speculated that he may have chosen the daycare because it was close to his home.
Earlier, Dumrongsak told reporters that the main weapon used was a 9mm pistol that the man had purchased himself. Paisal said he also had a shotgun and a knife.
Thailand's Prime Minister Prayut Chan-o-cha, who planned to travel to the scene on Friday, told reporters that initial reports were that the former officer was having personal problems.
"This shouldn't happen," he said. "I feel deep sadness toward the victims and their relatives."
Police have not given a full breakdown of the death toll, but they have said at least 22 children and two adults were killed at the daycare. At least two more children were killed elsewhere.
A teacher at the daycare who survived the attack said Khamrap pointed the gun at her head, but she was able to climb over a wall to escape.
"I knew it was a gun because I heard multiple gunshots, and then I saw him put in the bullets and point the gun at me.
"I called the teacher, and the teacher was hugging the child. He kicked the mirror and I climbed the walls and asked for help.
"He was inside the child centre for a long time. He used a knife and cut all the kids' heads. He was carrying a small gun.
"I didn't know he was going to kill the kids. I thought he was [going to] come out but he stayed inside a long time. He used a knife and stabbed all the kids.
"He also stabbed a pregnant teacher. Only [a] few months till she gives birth. He stabbed my staff. That's all I know."
"The shooter came in around lunchtime and shot four or five officials at the childcare centre first," local official Jidapa Boonsom told Reuters. "At first people thought it was fireworks," she said.
Khamrap was sacked from the police in January this year after being caught with pills containing meth and caffeine, reports said.
He had previously been warned for drug use after serving as a police officer for 10 years.
Colleagues claimed he had mood swings and was not popular at work.
Khamrap was said to have pulled a pistol on a bank manager who found him asleep, parked outside his bank when he was supposed to be guarding it, The Nation Thailand reported.
He was also said to have argued with his wife after he supposedly had an affair, and was reported to have argued with a neighbour after having raucous house parties.
Firearm-related deaths in Thailand are much lower than in countries such as the United States and Brazil, but higher than in Japan and Singapore, which have strict gun-control laws. The rate of firearms-related deaths in 2019 was about four per 100,000, compared with about 11 per 100,000 in the US and nearly 23 per 100,000 in Brazil.
Mass shootings are rare but not unheard of in Thailand, which has one of the highest civilian gun ownership rates in Asia, with 15.1 weapons per 100 population compared to only 0.3 in Singapore and 0.25 in Japan. That's still far lower than the US rate of 120.5 per 100 people, according to a 2017 survey by Australia's GunPolicy.org nonprofit organisation.
The country's previous worst mass shooting involved a disgruntled soldier who opened fire in and around a mall in the northeastern city of Nakhon Ratchasima in 2020, killing 29 people and holding off security forces for some 16 hours before eventually being killed by them.
Nearly 60 others were wounded in that attack. Its death toll surpassed that of the previously worst attack on civilians, a 2015 bombing at a shrine in Bangkok that killed 20 people. It was allegedly carried out by human traffickers in retaliation for a crackdown on their network.
Last month, a clerk shot co-workers at Thailand's Army War College in Bangkok, killing two and wounding another before he was arrested.