Uganda's main opposition leader, Kizza Besigye, was released on bail and greeted some 12,000 cheering supporters outside the courthouse where he is on trial on charges he says were fabricated to keep him out of next month's presidential election.
Thousands of opposition supporters celebrated his release on Monday in the streets of key towns in eastern, northeastern and southwestern Uganda, the independent K-FM radio station reported.
Besigye -- the first credible challenger to Ugandan President Yoweri Museveni's 19-year rule -- is being tried in the High Court for alleged treason and rape.
Separately he is charged by a military tribunal with terrorism and illegal possession of firearms.
Supporters say the charges were trumped up to keep Besigye from running against Museveni in February elections.
High Court Judge John Bosco Katutsi ordered on Monday that Besigye be released on bail, ruling that the military court's order to detain him was illegal because it was issued after the civilian court suspended the military tribunal's trial.
After the ruling, Besigye raised his hand and flashed a victory sign in court. Minor scuffles broke out when prison warders tried to keep him in custody, but Besigye managed to leave the chamber to sign release documents.
He returned briefly for a hearing on the rape charge, but it was suspended until today because of high tension over his release.
Outside the courthouse, police fired live bullets and tear gas to scatter a huge crowd of opposition supporters who broke through a police cordon to greet Besigye as he left the court and waved from the open roof of a sports utility vehicle.