“If the implications of this challenge are not satisfactorily resolved, they run the risk of casting a shadow of mistrust over our work,” he said.

“Practices which harm the sovereignty and relations of trust between states, and violate the individual freedoms which our countries so cherish, must be stopped,” he added.

Kerry, who is on his first trip to South America since he assumed his post in February, said: “Brazil is owed answers with respect to those questions and they will get them.”

“We will have this dialogue with the view to make it certain that your government is in complete understanding and complete agreement with what it is that we must to do provide security, not just for Americans, but for Brazilians and the people of the world,” Kerry added.

US officials have defended the surveillance programs as entirely lawful measures that have helped foil dozens of terrorist attacks around the world.