Ugandan officials say they have repelled an attack on a police post by gunmen in a northern district amid reports of mass arrests of soldiers accused of plotting against President Yoweri Museveni.

Ugandan police spokesman Fred Enanga said the military and the police repulsed the attackers after a firefight that lasted 30 minutes. He said the attackers carried automatic weapons.

He said two police officers and a soldier were injured in the assault in the remote district of Gulu.

Tensions have been rising in this East African country following a disputed election in February that was won by Museveni, in power since 1986. His main opponent, Kizza Besigye, claimed victory and was charged with treason.

The military is holding dozens of soldiers and officers over links to alleged subversion.