At least seven people have died and more than 30 others were injured after a 14-year-old student opened fire at a school and his home in Nonthaburi province, on the outskirts of Thailand’s capital Bangkok.
Thai Prime Minister Anutin Charnvirakul said the teenager killed his grandparents and five teachers before taking his own life. He said the boy still had "more than 30 bullets left" when he turned the gun on himself.
Authorities said nine of those injured remain in critical condition as police and emergency teams responded to the shooting.
The incident happened at a local branch of the prestigious Debsirin School, a well-known Thai secondary school with a long history and branches in different parts of the country.
Police officers were sent to the school as the shooting was still unfolding, while authorities warned members of the public to keep away from the area. People who were inside the building were advised to find safe places to hide and wait for rescuers.
National police chief Police General Kittiratt Phanphet said forensic officers had established that the shooter fired with considerable accuracy, with several shots striking vital parts of the body.
The prime minister described the attack as "well prepared" and said it had "clear steps and clear goals".
The teenager's identity has not been made public.
A seventh-grade pupil who managed to escape the school told the BBC she was in class when she saw the shooter moving from one room to another.
She said the attacker reached her classroom and shot the teacher who was standing near the entrance. The student said she could not see what happened afterwards.
Another pupil told Reuters that he initially believed the noise was caused by firecrackers or someone hitting an object.
"There were many shots: bang bang bang. Then it went quiet. Then it started again."
Police said the 9mm handgun used in the incident belonged to the shooter's grandfather, who had previously worked as a teacher.
Images from the scene showed students and members of staff leaving the school as those gathered outside appeared distressed following the incident.
The Debsirin School was established in Bangkok in 1885 and is regarded as one of Thailand's leading secondary schools. Its former students include diplomats, athletes and several people who have gone on to become prime ministers.
Following the shooting, the school appealed on social media for blood donations to help those injured.
Other schools around the area also suspended lessons and allowed students to return home earlier than usual.
Charnvirakul expressed condolences to the families of those killed and injured, saying the shooting should never have happened.
"I don't just feel sorry for the victims but I feel sorry that this happened. How can this happen in our country," he said.
The prime minister added: "this is why the government do not allow [citizens] to possess firearms".
Thailand has strict laws governing firearms, with illegal possession punishable by up to 10 years in prison. However, authorities have continued to face challenges in enforcing the restrictions.
Thailand also has one of the highest levels of civilian gun ownership in South East Asia, with estimates indicating that about 40% of privately held firearms are illegal.