Nearly 40 pupils have been killed at a school in western Uganda by rebels linked to the Islamic State group (IS).
Five militants attacked the Lhubiriha secondary school in Mpondwe at around 23:30 (20:30 GMT) on Friday.
They entered dormitories, setting fire and using machetes to kill and maim the pupils, officials said.
The Allied Democratic Forces (ADF) - based in the Democratic Republic of Congo - have been blamed and a manhunt is under way.
Warning: Some people may find details in this story distressing.
More than 60 people are educated at the school, most of whom live there.
Uganda's information minister said 37 students were confirmed to have been killed, but did not give their ages.
Twenty of them were attacked with machetes and 17 of them burned to death, Chris Baryomunsi told the BBC.
The Ugandan army said the rebels had also killed a school guard and three members of the local community.
Survivors said the rebels threw a bomb into the dormitory after the machete attack. It is not clear if this resulted in a fire in the building which was reported earlier.
Six students were also abducted to carry food that the rebels stole from the school's stores, he added. The militants then returned across the border into the DR Congo.
Some of the bodies are said to have been badly burnt and DNA tests will need to be carried out to identify them.
Eight people remain in a critical condition after the attack.
UN Secretary General Antonio Guterres condemned the "appalling act" and called for those behind it to be brought to justice.
Soldiers are pursuing ADF insurgents towards the DR Congo's Virunga national park - which is home to rare species, including mountain gorillas.
Militias including the ADF also use the vast expanse, which borders Uganda and Rwanda, as a hideout.
"Our forces are pursuing the enemy to rescue those abducted and destroy this group," defence spokesperson Felix Kulayigye said on Twitter.
The Ugandan army has also deployed helicopters to help track the rebel group over mountainous terrain.
The two neighbours have held joint military operations in the east of DR Congo to prevent attacks by the ADF.
Security forces had intelligence that rebels were in the border area on Congolese side for at least two days before Friday night's attack, Maj Gen Olum said.
But local residents have criticised the authorities for not being prepared for an attack.
"If they are telling us the borders are secure and security is tight, I want the security to tell us where they were when these killers came to kill our people," one resident told reporters.
The deadly episode follows last week's attack by suspected ADF fighters in a village in DR Congo near to the Ugandan border. More than 100 villagers fled to Uganda but have since returned.
The attack on the school, located less than 2km (1.25 miles) from Congolese border, is the first such attack on a Ugandan school in 25 years.
In June 1998, 80 students were burnt to death in their dormitories in an ADF attack on Kichwamba Technical Institute near the border of DR Congo. More than 100 students were abducted.
The group may target schools as a way of recruiting children, according to Richard Moncrieff, an expert in the region at the International Crisis Group. But they also do it for the shock value, he told the BBC.
"These are terrorist groups who want to make and impact through violence, they want to show that they are there, show that they are active to their colleagues and allies in Isis in other parts of the world," Mr Moncrieff said, using another acronym for IS.
The ADF was created in western Uganda in the 1990s and took up arms against long-serving President, Yoweri Museveni, alleging government persecution of Muslims.
Muslims make up almost 14% of the Ugandan population, according to official government figures, though the Ugandan Muslim Supreme Council estimates the figure is closer to 35%.
Some members of the Ugandan Muslim community say they face discrimination in public life, including in education and the workplace.
After defeat by the Ugandan army in 2001, the ADF relocated to North Kivu province in DR Congo.
The group's principal founder, Jamil Makulu, was arrested in Tanzania in 2015 and is in custody in a Ugandan prison.
ADF rebels have been operating from inside DR Congo for the past two decades.
Makulu's successor, Musa Seka Baluku, reportedly first pledged allegiance to IS in 2016, but it was not until April 2019 that the group first acknowledged its activity in the area.
IS is a group has been mostly defeated, though there are significant numbers of IS-affiliated militant groups across the Middle East and Africa.
After years of not operating openly in Uganda, the ADF was blamed for a series of attacks in late 2021 including suicide bombings in Uganda's capital Kampala.
(c) 2023, BBC News