Judge Ivani Silva da Luz said the planned celebration of the country’s 1964 coup Sunday was not "compatible with the process of democratic reconstruction" promoted by the 1988 constitution and that commemorative dates must be approved by Congress.
However, Friday's ruling may not be altogether effective since several military units have already held events this week commemorating the coup, AFP reported.
Bolsonaro's order to the armed forces to mark the overthrow of President João Goulart has been widely criticized, with the attorney general's office calling on personnel Wednesday to "abstain" from paying tribute to a regime that committed "serious human rights violations."
In 1964, President Goulart was overthrown by the military, who imposed a military dictatorship in Brazil that lasted two decades until 1985, when Tancredo Neves was elected as the first civilian president in a vote carried out by Congress.
Throughout his political career, Bolsonaro has proved to be nostalgic for the military dictatorship. During the impeachment trial that removed Dilma Rousseff of power, then-congressman Bolsonaro dedicated his vote to Colonel Carlos Alberto Brilhante, one of the chiefs of the repressive network from the former dictatorship.
According to a report from the Truth Commission, the military dictatorship in Brazil left 434 dead or disappeared, and was responsible for numerous cases of persecution and torture.
The far-right leader, whose approval rating sank in March after a series of political scandals tainted his first three months in office, had received little support outside his own ultraconservative Social Liberal Party (PSL) for the controversial idea.
Former presidential candidates Fernando Haddad and Guilherme Boulos said they “completely disavow” the president's decision to allow the Ministry of Defense to celebrate the military coup.
Brazilians took to social media following the news calling out Bolsonaro for "celebrating" the military dictatorship and its coup using the hashtag #DitaduraNuncaMais (No More Dictatorship).
"Hey world! While different countries around the world are ashamed of their authoritarian past, the president of Brazil, @jairbolsonaro chooses to celebrate the military dictatorship’s anniversary. (+) #DitaduraNuncaMais," a Brazilian said in a tweet using the hashtag.