Douma, an activist aligned with Egypt's secular and liberal democracy movement, was jailed for "insulting the court" after he accused Judge Mohamed Nagy Shehata of bias against the opposition.
He questioned whether the judge was using a Facebook account to denounce opposition members, a popular theory among activists on social media.
The judge reportedly denied having an account, saying only people like Douma and "his friends" use the site, according to the English-language site Ahram Online.
The judge then found Douma to be in contempt of court, imposing the jail sentence and fining him almost $1,400. Douma responded by shouting, "Down, down, military rule!" from his court-room cage, according to Reuters.
Last month, Egypt's lawyers union publicly criticized Judge Shehata for "disparaging" and "terrorizing" Douma's defense team.
Douma had been on trial with more than 260 other defendants, accused of attacking a government building in December 2011.
He was a leading figure in the 2011 uprising that toppled former leader Hosni Mubarak, but also took part in later demonstrations against Islamist President Mohamed Morsi, as well as the current role played by the military in Egypt.
In June, Judge Mohamed Nagy Shehata also presided over the notorious trial in which three Al Jazeera journalists – an Australian, a Canadian, and an Egyptian – were jailed from seven to 10 years – on evidence widely denounced as ridiculous – for supposedly supporting the Muslim Brotherhood.
Last week, Shehata sentenced 188 defendants to death for an alleged attack on a police station in 2013.
David Mack is a reporter and weekend editor for BuzzFeed News in New York.
Contact David Mack at email@example.com.
Got a confidential tip? Submit it here.