Further demonstrations against the 1964-1985 dictatorship are planned in Rio de Janeiro and Sao Paulo after far-right President Jair Bolsonaro sparked widespread anger by ordering the defense forces to commemorate the overthrow of President Joao Goulart.
Nearly 1,000 noisy protesters in Brasilia accused Bolsonaro, an ex-army captain and unabashed admirer of the country's former dictators, of being a "militant" and demanded "Bolsonaro out."
The demonstration came a day after an appeals court judge overturned another judges decision to bar commemorations sought by Bolsonaro, Presstv Reported.
Appellate judge Maria do Carmo Cardoso accepted the government's argument that Brazilian democracy was strong enough to support "a pluralism of ideas."
"I see no violation of human rights, particularly as similar demonstrations took place in the barracks in preceding years with no negative consequences," she wrote.
Bolsonaro, who is on a three-day visit to Israel, is the country's first president since democracy was restored in 1985 to publicly exalt the military regime, though he argues its rise to power was not a "coup."
In the past, the tough-talking Bolsonaro has referred to the dictatorship as a "glorious" time in Brazilian history. He was quoted in 2008 as saying that "the error of the dictatorship was that it tortured but did not kill."
Since taking office, Bolsonaro has had fond words for military dictators in 1970s and 1980s Latin America, such as Alfredo Stroessner of Paraguay and Chile's Augusto Pinochet.
At least 434 people were killed or disappeared in Brazil during the 21-year dictatorship, far fewer than the 30,000 deaths in Argentina and more than 3,200 in Chile during their respective periods of right-wing military rule.
But unlike its South American neighbors, Brazil has not prosecuted military officials for regime-era crimes, leaving the events of that dark period unresolved.
Bolsonaro, who ran for the presidency as a political outsider determined to dismantle a culture of corruption, has seen his approval rating plunge amid scandals and missteps since his January 1 inauguration.