Speaking in his 13th floor office in Brussels, Mr. Barroso voiced alarm at recent reports that a secret United States surveillance program had invaded the privacy of Europeans. The program, known as Prism and revealed by a former National Security Agency contractor, Edward J. Snowden, “certainly raises serious concerns in Europe,” he said.

“While we understand certainly the concerns of security that we share with our friends and allies regarding the serious threat that terrorism represents,” he said, “we believe that it cannot be done in clear violation of fundamental rights, namely of people who have nothing to do with this kind of threat.”

The fight against terrorism, Mr. Barroso added, hinges on “the moral superiority of democracies” and must be “based on the respect for basic human rights and fundamental freedoms.”

He said, “I think we should not lose that moral ground when we deal with this threat, which is terrorism.”

Mr. Barroso also challenged calls by Washington and from many in Europe for a retreat from policies of austerity. The push for fiscal discipline that has dominated the European Union’s response to what began as a financial crisis after the collapse of Lehman Brothers in 2008 has grown into a broader economic debacle that has plunged much of the region into recession and left more than 26 million Europeans unemployed.

“We should keep the fiscal consolidation,” said Mr. Barroso, referring to the budget cuts and tax increases that are the main pillars of austerity.

Debate over Europe’s response to the crisis has fed into a wider discussion over the impact of globalization and whether, at a time of deep economic malaise, a proposed trade pact with the United States would relieve or only add to Europe’s problems.