SAO PAULO, Brazil -- Brazil's president signed into law on Wednesday a "Bill of Rights" for the digital age that aims to protect online privacy and promote the Internet as a public utility by barring telecommunications companies from charging for preferential access to their networks.

The law signed by President Dilma Rousseff at a global conference on the future of Internet governance puts Brazil in the vanguard of online consumer protection and what is known as "net neutrality," whose promoters consider it profoundly democratic in part because it keeps financial barriers for innovators low.

The new law promotes privacy by limiting the data that online companies can collect on Internet users in this nation of 200 million people, deeming communications over the Internet "inviolable and secret." Service providers must develop protocols to ensure email can be read only by senders and their intended recipients. Violators are subject to penalties including fines and suspension.

The law obliges Internet companies, however, to hold on to user data for six months and hand it over to law enforcement under court order.

Enactment of the law, which won final legislative approval in the Senate late Tuesday, coincided with Brazil's hosting of a global conference widely seen as an effort to chart a path for a less U.S.-centric Internet and attended by high-level delegations from countries including Germany and the United States.

Brazil cast itself as a defender of Internet freedom after revelations last year that the U.S. National Security Agency had spied on Rousseff, her close advisers and Brazilian commercial interests, including the state-run oil company Petrobras.

Rousseff cancelled a state visit to the U.S. in October over the disclosures, the result of damaging leaks by former NSA contractor Edward Snowden. She said she would promote more home-grown Internet services beginning with a national email service, and make Brazil's piece of the global Internet less U.S.-dependent, in part by laying an undersea cable to Europe. The bulk of Latin America's Internet traffic passes through the United States.

Attendees among the more than 800 people who filled a hotel ballroom at the NETMundial forum Wednesday generally praised Rousseff.

"It is a fantastic example of how governments can play a positive role in advancing Web rights and keeping the Web open," said the World Wide Web's inventor, Tim Berners-Lee.

Rousseff called the law's "net neutrality" clause "fundamental to maintaining the Internet's free and open nature." It bars companies that sell Internet service from turning their networks into toll roads.

Such companies argue they need to charge more for content that demands higher bandwidth, such as video streaming or voice communications.

Net neutrality advocates say the Internet should be treated as a public utility, especially as consolidation in the telecommunications business reduces the number of providers so that many operate as near monopolies.

The Brazilian law's enactment follows the overwhelming passage earlier this month by the European Parliament of a net neutrality bill.

Other countries that have net neutrality laws include Netherlands and Chile, which was the first to do so in 2010. In the United States, net neutrality rules imposed by the Federal Communications Commission were struck down by a court in January. The following month, movie-streamer Netflix struck a deal with Comcast to pay for preferential treatment of Internet traffic bearing its film streams.

As the Internet has expanded to mobile devices, telecoms without "net neutrality" can reserve better network performance for services that they themselves sell or reserve big chunks of bandwidth for a company such as Netflix.

"I believe that neutrality, privacy, freedom and the absence of discrimination guaranteed in the text are really going to put Brazil in the vanguard as a model for various other countries," Interior Minister Jose Eduard Cardozo was quoted as saying on Rousseff's blog.

One topic discussed at NETMundial was the U.S. government's recent announcement that it plans to turn over the Internet Corporation for Assigned Names and Numbers, which manages the core functions of the Internet, to a "global multi-stakeholder community" once its contract with the U.S. Commerce Department expires in 2015.

Known as ICANN, the institution has allocated domain names and the numerical addresses to which they are attached since 1998.

China, Russia and other countries have advocated putting management of the Internet's core under control of the International Telecommunications Union, a U.N. body. But online civil liberties activists and governments including the United States oppose the idea, fearing such a move would strengthen the hand of countries that have been censoring online expression.

------

Associated Press technology writer Frank Bajak in Lima, Peru, contributed to this report.