Ugandan opposition leader Kizza Besigye has been taken to a military court instead of the High Court, where he had been due to have a bail hearing.
Dr Besigye denies links to rebel groups
He has been charged with terrorism and illegal possession of firearms. He refused to speak, on the basis that he should not be tried by the military.
Dr Besigye has been held since his arrest on charges of treason and rape.
His supporters say all the charges are to stop him challenging President Yoweri Museveni in next year's polls.
But presidential advisor John Nagenda has told the BBC he was sure that Mr Besigye would be able to stand in the elections despite the charges.
The army has said that it has jurisdiction over anyone found in possession of weapons of war.
Used to be Museveni's doctor
March 2001: Ran against Museveni
August 2001: Went into exile
Oct 2005: Returned home
Nov 2005: Charged with treason, rape
When two of Dr Besigye's lawyers argued that the court martial, being held inside an army barracks, had no jurisdiction over a civilian, they were arrested by the military for contempt of court.
Court martial head General Elly Tumwine entered a plea of "not guilty" on Dr Besigye's behalf when he refused to speak.
"Besigye is going to be condemned to death by a kangaroo court," said his wife, Winnie Byanyima, a former MP.
Officials from Dr Besigye's Forum for Democratic Change fear the military charges may allow the authorities to continue holding him even if a civilian judge grants him bail.
He is due back in both the High Court and the military court on Friday.
The government says it has evidence that Dr Besigye contacted rebel groups in order to topple Mr Museveni.
The FDC has filed papers contesting the legality of the military charges for 14 people charged alongside Dr Besigye.
Dr Besigye's arrest earlier this month sparked two days of riots. It was condemned by the United States.
Recently, the government banned public demonstrations in the capital, Kampala and also warned the media not to discuss the case.
Mr Museveni has been praised for raising living standards in Uganda after years of misrule but this year, the UK and other donors withheld some aid to Uganda in protest at moves to change the constitution, allowing him to seek a third term.
On Saturday, he was elected unopposed as his party's presidential candidate for polls due by March 2006.
Information Minister James Nsaba Buturo said that any newspapers or radio stations breaking the ban on discussing cases before the courts would be closed down.
Journalists say this is unconstitutional and goes far beyond normal laws, designed to stop judges being influenced by the media.
President Museveni has been praised for ending years of misrule in Uganda
Once Mr Museveni's doctor, Dr Besigye ran against the president in 2001 before fleeing after the elections, saying his life was in danger.
Dr Besigye returned from four years of exile last month to large crowds of cheering supporters.
If found guilty of treason, he and 22 co-accused could face the death penalty.
Dr Besigye has previously denied allegations that he is linked to rebel groups.
He has also denied rape charges which date from 1997, allegedly involving the daughter of a friend.