At the U.N. General Assembly, Brazilian President Dilma Rousseff delivered a stinging rebuke of electronic espionage by the National Security Agency. (Thomas LeGro/The Washington Post)

Brazilian President Dilma Rousseff on Tuesday delivered a stinging rebuke of electronic espionage by the National Security Agency, telling a gathering of world leaders at the U.N. General Assembly that American eavesdropping constitutes “a breach of international law and an affront” to Brazil’s sovereignty.

America’s spying efforts pose a threat to democracy throughout the world, Rousseff said, as she proposed that the United Nations establish legal guidelines to prevent “cyberspace from being used as a weapon of war.”

“Without the right of privacy, there is no real freedom of speech or freedom of opinion, and so there is no actual democracy,” Rousseff said. And “without respect for [a nation’s] sovereignty, there is no basis for proper relations among nations.”

A series of disclosures about U.S. surveillance in Brazil — based on leaks by former NSA contractor Edward Snowden — have caused a furor in that country. Earlier this month, Rousseff canceled a state visit to Washington over the revelations.

The Brazilian government and the United States have played down the impact of the controversy on long-term relations, but Rousseff, who is seeking reelection in Brazil, left little doubt Tuesday that the issue remains a significant irritant between the two countries.

Rousseff said that her government has filed a formal protest against the United States, demanding an apology and a “guarantee that such acts will not be repeated.”

“Those who want a strategic partnership cannot possibly allow recurring and illegal action to go on as if they were an ordinary practice,” she said.

Rousseff also dismissed as “untenable” Washington’s contention that the United States needed to monitor electronic communications as part of its global campaign to fight terrorism.

“Brazil knows how to protect itself,” she said. “Brazil . . . does not provide shelter to terrorist groups. We are a democratic country.”

The broadside came as President Obama waited in the wings of the U.N. assembly hall to deliver his fifth address to the U.N.’s most representative body. Obama did not address Rousseff’s remarks but did make indirect reference to the controversy over NSA surveillance, saying that the United States has begun to review the way it gathers intelligence so that it can “properly balance the legitimate security concerns of our citizens and allies with the privacy concerns.”