structural:summarization
Ugandan Bush War

In 1978, Fred Rwigyema returned to western Uganda and reunited with Kagame. During his absence, Rwigyema had joined the rebel army of Yoweri Museveni. Based in Tanzania, it aimed to overthrow the Ugandan government of Idi Amin. Rwigyema returned to Tanzania and fought in the 1979 war during which Museveni's rebel group, FRONASA, allied with the Tanzanian army and other Ugandan exiles, defeated Amin. After Amin's defeat, Kagame and other Rwandan refugees pledged allegiance to Museveni, who had become a cabinet member in the transition government. Kagame received training at the United States Army Command and General Staff College, Fort Leavenworth, Kansas.

Former incumbent Milton Obote won the 1980 Ugandan general election. Museveni disputed the result, and he and his followers withdrew from the new government in protest. In 1981, Museveni formed the rebel Popular Resistance Army (PRA); Kagame and Rwigyema joined as founding soldiers, along with 38 Ugandans. The army's goal was to overthrow Obote's government, in what became known as the Ugandan Bush War. Kagame took part in the Battle of Kabamba, the PRA's first operation, in February 1981.

Kagame and Rwigema joined the PRA primarily to ease conditions for Rwandan refugees persecuted by Obote. They also had a long-term goal of returning with other Tutsi refugees to Rwanda; military experience would enable them to fight the Hutu-dominated Rwandan army. The PRA merged with another rebel group in June 1981, forming the National Resistance Army (NRA). In the NRA, Kagame specialized in intelligence-gathering, and he rose to a position close to Museveni's. The NRA, based in the Luwero Triangle, fought the Ugandan army for the next five years, even after Obote was deposed in a 1985 coup d'état and the start of peace talks.

In 1986, the NRA captured Kampala with a force of 14,000 soldiers, including 500 Rwandans, and formed a new government. After Museveni's inauguration as president he appointed Kagame and Rwigyema as senior officers in the new Ugandan army; Kagame was the head of military intelligence. In a 2018 paper, Canadian scholar and Rwanda expert Gerald Caplan described this appointment as a remarkable achievement for a foreigner and a refugee. Caplan noted Museveni's reputation for toughness, and said that Kagame would have had to be similarly tough to earn such a position. He also commented on the nature of military intelligence work, saying "it is surely unrealistic to expect that Kagame refrained from the kind of unsavory activities that military security specializes in." In addition to their army duties, Kagame and Rwigyema began building a covert network of Rwandan Tutsi refugees within the army's ranks, intended as the nucleus for an attack on Rwanda. In 1989, Rwanda's President Habyarimana and many Ugandans in the army began to criticise Museveni over his appointment of Rwandan refugees to senior positions, and he demoted Kagame and Rwigyema.

Kagame and Rwigeema remained de facto senior officers, but the change caused them to accelerate their plans to invade Rwanda. They joined an organisation called the Rwandan Patriotic Front (RPF), a refugee association which had been operating under various names since 1979. Rwigyema became the RPF leader shortly after joining and, while still working for the Ugandan army, he and Kagame completed their invasion plans.