(CNN) -- Brazil, a leading critic of American spying, appeared caught in a bind when a news report claimed that the South American giant conducted espionage of its own.
But there is no hypocrisy here, the Brazilian government says, even as it defends its own snooping by using the same arguments the United States has espoused.
"I see the situations as completely different," Brazilian Justice Minister Jose Eduardo Cardozo told Folha de Sao Paulo, the newspaper that broke the story of Brazil's spying, in comments reported Tuesday.
What the NSA is accused of doing to Brazil and other countries is a breach of secrecy, he said.
"That is interception of data, interceptions of phone calls. Intercepts that affront Brazil's sovereignty," he said.
What Brazil did was engage in counterespionage measures that are allowed under its law, the minister said.
Based on reports, the type of spying Brazil engaged in pales in comparison with what the United States is accused of.
Diplomatic relations between the the United States and Brazil were strained after leaked documents claimed that the U.S. National Security Agency spied on Brazilian President Dilma Rousseff and her aides.
In the wake of the NSA scandal, Brazil postponed a state visit to the United States, and Brazil and Germany were drafting a United Nations resolution on privacy in electronic communication.
The twist came last week, when Folha de Sao Paulo revealed that Brazil itself spied on foreign diplomats inside Brazil in 2003 and 2004. Its targets included officials from Russia, Iran and the United States.
On Monday, Brazil's Institutional Security Cabinet, which overseas intelligence gathering, admitted that it had spied but defended its actions.
Not only did the spying take place 10 years ago, but it took place within the bounds of Brazilian laws to protect national interests, the government said in a statement.
While respecting the freedom of the press in Brazil, it is a crime to leak classified information, and those responsible for the leak will be prosecuted, the statement said.
These statements echo U.S. arguments that it acted within its legal framework and that the U.S. leaker, Edward Snowden, should face criminal charges.
Cordozo gave a third argument in defense of the Brazilian spying, which also sounds familiar: that every country engages in this type of activity.
The difference, he told Folha de Sao Paulo, is that Brazil's spying did not violate anyone's rights or sovereignty.
"This seems to me a very crucial difference," he said. "If we don't make that distinction, it gives the impression that what we are using the same method that we are criticizing. That is not the case."