At least 40 people have been killed in a terrorist attack on a school in western Uganda, police said Saturday.

At least eight people, police said, were injured in the attack by militants linked to the Islamic State group- Allied Democratic Forces militia, on the Lhubirira secondary school in Mpondwe, near the border with the Democratic Republic of Congo.

It was not immediately clear how many of the victims are children.

According to Ugandan media, security officers are in pursuit of the rebel group who fled towards Virunga National Park in the DRC.

"So far 25 bodies have been recovered from the school and transferred to Bwera Hospital", Uganda National Police Spokesperson Fred Enanga said in a statement on Saturday.

More follows...