On 27 July, several officers of the UNLA launched a coup which overthrew President Obote. General Tito Okello assumed power in his place. The new regime was weak and unstable, and Okello made overtures to anti-Obote rebel groups to form a coalition government and end the fighting. The coup upset many Lango soldiers, which constituted the second-largest ethnic group in the UNLA and were loyal to Obote. The NRM was highly critical of the new government and accused the UNLA of committing atrocities. The UNLF, conscious of its weakening political position, nevertheless pursued negotiations with the NRM. Museveni took advantage of the disruption caused by the coup to return to East Africa and rebuild the NRA. In August the NRA launched a series of co-ordinated attacks that resulted in the capture of significant amounts of territory in central and western Uganda. In late September, the NRA laid siege to the UNLA troops in the provincial centre of Masaka and, soon thereafter, the town of Mbarara, both key urban areas in southern Uganda. In October Museveni warned that, in the event of the failure negotiations ongoing between the NRM and the UNLF in Nairobi, "the NRA would take Kampala by force". On 3 December Okello's government released a document allegedly seized from the NRA which carried an order from Museveni to the NRA Chief of Staff, Salim Saleh, to prepare to attack the Ugandan capital, Kampala, if a peace agreement did not materialise. The NRM did not comment on the disclosure. On 10 December Masaka's garrison surrendered to the NRA. On 17 December the UNLF and NRM concluded talks and signed the Nairobi Peace Agreement. The accord nominally ended the war and declared Okello and Museveni President and Vice President of Uganda, respectively, and required the demilitarisation of Kampala until a new army could be established. It also carried a provision which stipulated that one belligerent could disregard the agreement if the other was found to be violating human rights. The NRM accused the UNLA of failing to respect Ugandans' rights, and the NRA continued fighting. On 31 December the UNLF government accused the NRA of failing to uphold its terms of the peace agreement by launching attacks, impeding the flow of food to the Mbarara garrison, and refraining from nominating representatives to coordinate further peace measures with the government. The UNLA forces at Mbarara capitulated soon thereafter.
