Brazil signaled its emergence as a leader on internet freedom today as President Dilma Rousseff signed new legislation into law. Popularly known as the Marco Civil, the new law has been carefully crafted and relentlessly debated by Brazilian activists and politicians for the past five years. The Marco Civil gained new impetus with the revelations of NSA spying by Edward Snowden, which suggested that the U.S. government may have monitored the communications of Rousseff and other dignitaries. Brazil went on to push forward a resolution with Germany at the UN that called for countries to respect the privacy of their citizens online.

The new legislation promotes net neutrality, protects intermediary liability, and supports freedom of expression. Tech companies must still retain data for one year, creating some concerns for privacy advocates, but this was negotiated down from five years, according to TechDirt.

Importantly, advocates also hailed the fact that the bill was was negotiated with a variety of stakeholders that shaped the law into its current form. For example, a controversial provision that would have required companies to have local servers in Brazil was eliminated, much to the relief of companies like Google, who already found their local corporate officers hauled into court for refusing to take down otherwise lawful content. The Marco Civil passed the Chamber of Deputies but required approval by the senate and a signature by President Rousseff, both of which happened this week.

Researcher Joana Varon of Fundaçao Getulio Vargas, speaking to Global Voices in March, noted that:

The approval of Marco Civil, a bill of rights to protect users, is important not only for the country, but also for the world….In a context where the interests of telecom operators, copyright industry, IT companies and sometimes even the Brazilian state are essentially in opposition with the protection of user’s rights, having a text — developed in an open, transparent and participative way — that protects of the right to access, to privacy protection, to freedom of expression, and net neutrality, among others, is a very, very positive step.

As the world’s social media descends upon Brazil for this summer’s World Cup, and the Olympics in Rio de Janeiro in 2016, this is very welcome news indeed.