In 1971 Colonel Idi Amin seized power in Uganda following a military coup that overthrew President Milton Obote, precipitating a deterioration of relations with neighbouring Tanzania. Tanzanian President Julius Nyerere had close ties with Obote and had supported his socialist orientation. Amin installed himself as President of Uganda and ruled the country as a repressive dictatorship. Nyerere withheld diplomatic recognition of the new government and offered asylum to Obote and his supporters. Uganda twice launched military attacks against the Tanzanian border that year. With the approval of Nyerere, Ugandan exiles organised a small army of guerrillas, and attempted, unsuccessfully, to invade Uganda and remove Amin in 1972. Amin blamed Nyerere for backing and arming his enemies, and retaliated by bombing Tanzanian border towns. Though his commanders urged him to respond in kind, Nyerere agreed to mediation overseen by the President of Somalia, Siad Barre, resulting in the signing of the Mogadishu Agreement, which stipulated that Ugandan and Tanzanian forces had to withdraw to positions at least 10 kilometres (6.2 miles) away from the border and refrain from supporting opposition forces that targeted each other's governments. Nevertheless, relations between the two presidents remained tense; Nyerere frequently denounced Amin's regime, and Amin made repeated threats to invade Tanzania. During the same time, relations between Tanzania and Kenya grew sour, and the East African Community subsequently collapsed. Uganda also disputed its border with Tanzania, claiming that the Kagera Salient—a 1,865 square kilometre (720 sq mi) stretch of land stretch of land between the official border and the Kagera River 29 km (18 mi) to the south—should be ceded to Uganda, maintaining that the river made for a more logical border. The border had originally been negotiated by British and German colonial officials before World War I.