Museveni praised Russia on Tuesday as a partner in the struggle against colonialism going back a century.
"Whenever issues come up and some people want us to take positions against Russia, we say 'but you people, these people have been with us for the last 100 years, how can we be automatically against them?'" Museveni said.
The Ugandan leader, who has gripped power for 36 years, added "We have even forgiven our former enemies, the colonialists, the ones who have colonized us, the ones who had actually taken slaves from here and who did bad things. We have forgiven them and we are working them," he said.
His statement came during a joint news appearance with Russian Foreign Minister Sergei Lavrov, who came to Uganda after visiting Egypt and the Republic of Congo.
From Uganda, he will head to Ethiopia, which has long been a stalwart ally of the West but has recently rowed with the United States over its conduct of a conflict in its northern region of Tigray.
In response to Museveni, Lavrov praised what he described as "the responsible and balanced position taken by Uganda and other African states", accusing the West of displaying a colonial mindset by demanding that Africa adopt an anti-Russian stance.
Uganda was among 17 African nations that abstained in a March vote on a United Nations resolution condemning the Russian invasion, which was supported by 141 countries out of 193.
Museveni's warm praise of Russia is in sharp contrast to the views of French President Emmanuel Macron, who is also on an African tour. He said in Cameroon on Tuesday that Moscow is using food as a "weapon" to coerce hungry African nations to hew to its side. Macron's position is also echoed in other western capitals.