SAO PAULO -- A Brazilian federal judge on Tuesday ordered President Jair Bolsonaro to comply with local rules to wear a face mask whenever he is outdoors in the capital of Brasilia.

In recent weekends, a sometimes unmasked Bolsonaro has joined throngs of people protesting against Brazil's Congress and Supreme Court and he has visited bakeries and outdoor food stalls, drawing crowds around him.

Since the end of April, Brazil's federal district requires people to wear face masks in public to help control the spread of the new coronavirus. Failure to comply carries a possible daily fine of $390.

Judge Renato Coelho Borelli said in his ruling that Bolsonaro “has exposed other people to the contagion of a disease that has caused national commotion.”

The Brazilian presidentdid not immediately comment on the decision. An earlier court ruling required him to publish the results of three COVID-19 tests he took early March, and all were negative for the virus. He has not disclosed any tests since then.

Bolsonaro sometimes appears in public events with a mask, unlike some other heads of state, including U.S. President Donald Trump, Mexico's Andres Manuel Lopez Obrador and Argentina's Alberto Fernandez, who has often hugged supporters and taken selfies with them while not wearing a mask, although use of a mask is mandatory in Argentina's capital.

The Brazilian president has downplayed the risk of COVID-19 and insisted the negative economic impacts of social isolation will be worse than the harm caused by the virus. More than 51,000 people have died of COVID-19 in Brazil.

Associated Press writer Mayra Pertossi contributed from Buenos Aires, Argentina.