The Brazilian Congress approved on Thursday legislation allowing parties and candidates to force social media outlets to immediately withdraw offensive or defamatory content by anonymous authors.
The law was included in a late vote in Congress of a set of rules for next year's general election, and was met with harsh criticism from groups defending civil rights and online freedom of expression.
Social media would have to provide the full name, identification and social security number of the author to keep the comment online, although it was not clear where they would need to send that information.
The legislation, which does not require a judicial order for candidates or parties to request the withdrawal of content from websites and apps, could be blocked by Brazil's President Michel Temer, who is expected to sign the broader set of rules for 2018 elections by Saturday.
There was no immediate comment from the Temer administration regarding his likely action regarding the restrictions.
"That piece of legislation will transform candidates and parties into electoral judges, with powers to take out of the web any content they consider offensive to them," said Carlos Affonso Souza, a director at the Institute of Technology and Society (ITS), an organization defending a freer online environment.
Three associations representing newspapers, magazines, radio and television stations in Brazil released a joint statement Thursday calling the law a form of censorship.
"Brazil's internet legal framework clearly states that only through a judicial order it is possible to force the withdrawal of online content," the entities said.
Congressman Aureo, from Brazil's Solidariedade party, the author of the legislation, defended the rule saying it would give transparency to online content.
"Freedom of expression is guaranteed, but it cannot be anonymous," he told Reuters.