Militants linked to the Islamic State group killed 37 people and abducted six others in an attack on a school in western Uganda near the border with the Democratic Republic of Congo, the military said on Saturday.

Military personnel found the bodies of the dead when they arrived at the school, defense spokesperson Felix Kulayigye said in a statement.

"Our forces are pursuing the enemy to rescue those abducted and destroy this group," he said earlier on Twitter. The attackers, from the rebel group Allied Democratic Forces (ADF), fled towards Virunga National Park in Congo, police said.