Prosecutors charged Kizza Besigye hours after heavily armed police officers arrested him in Kampala's Busega suburb following his address to a political rally in Mbarara, 250 kilometres west of Kampala.
The charge sheet said Mr Besigye and 22 others committed treason and had been planning to overthrow the government.
The sheet also outlined his links to the People’s Redemption Army, a rebel outfit said to be based in the eastern areas of neighbouring Democratic Republic of Congo.
Presiding magistrate Margaret Tiburua remanded Mr Besigye, who was not required to plead to the charges, to the Ruzila Maximum Security prison near his home.
Besigye’s arrest triggerd riots
The arrest has sparked protests and subsequent riots on the streets across the country, which have left one person dead and many others injured.
Authorities deployed military personnel to guard the central police station against looters.
Police are battling stone throwing mobs, who have wrecked a government vehicle, vendors’ kiosks as well as barricades along main roads.
An unknown number of people, including a journalist, were wounded by rubber bullets, officials said.
Besigye’s party calls arrest harrassment
Suleiman Kiggundu, the chairman of the FDC, said Mr Besigye's arrest was "a barbaric act", and went even further to describe it as "savage".
"We are not going to take this lying down. We are also going to use all means, political, legal and any other," he said, adding: "We are going to organise people to demonstrate against this."
Tension between the political leaders
Mr Besigye, who lost a disputed 2001 presidential election to President Museveni, fled Uganda for four years of exile.
He settled in South Africa after the polls, when the president and other government officials accused him of colluding with rebel groups to foment a coup.
He returned home on October 26 in an apparent bid to take advantage of Mr Museveni's calls for reconciliation.
The apparent rapprochement followed this month's death in exile of former Ugandan leader Milton Obote, a foe of the president who nonetheless was granted a state funeral.
In addition to accusing President Museveni of running a 'dictatorship' and detaining political prisoners, Mr Besigye has urged Uganda's fractured opposition to unite around a single candidate to oust the government in elections planned for March.
It is unlikely that Mr Besigye will be able to vie for the Presidency, but if he does he will face President Museveni, who recently pushed through constitutional amendments scrapping term limits.
The move allows Mr Museveni to stand for a third term in office, which has be criticised by the opposition as a tool for the president to rule Uganda for the rest of his life.
