Stripping the National Security Agency of its ability to collect the communications data of American citizens would enable terrorists to strike the United States, the head of the NSA told Congress Tuesday.

“They didn’t stop hating us,” Keith Alexander told the House intelligence committee, admonishing lawmakers not to “give up a program that would result in this nation being attacked.”

Tuesday’s intelligence committee hearing offered a forum for top national security officials to continue to defend the NSA’s activities against a growing backlash at home and abroad, as legislators consider proposals that could significantly curtail the NSA’s data collection activities–or allow them to continue. Alexander and the other officials on the panel made their opposition to any significant changes known.

“We only work within the law,” Director of National Intelligence James Clapper told the intelligence committee. “The rigorous oversight we’ve been under has been effective.”

Clapper also pushed back against stories that the NSA spied on the communications of foreign countries, saying that the US does not “spy indiscriminately on the citizens of any country.” Alexander said that the stories about the NSA’s monitoring of communications in foreign countries were inaccurate, and the idea that the “NSA or the US collected that information is false, and it’s false that it was collected on European citizens.” Rather, Alexander claimed, the data had been gathered by those countries’ governments and then shared with the NSA.

Later, however, Clapper insisted that it’s not unusual for foreign countries, including ones with friendly relationships, to spy on each other’s leaders. Clapper cited “Casablanca” in mocking the reactions to the news that the NSA had spied on communications in foreign countries. “My god, there’s gambling going on here?” Clapper said. Foreign countries “absolutely” spy on the United States, he said.

Clapper also defended U.S. keeping snooping on foreign leaders, saying that spying on them in order to divine their intentions was “one of the first things I learned in intelligence school in 1963.” Obama has recently apologized to several world leaders for spying on them.

The intelligence chiefs’ testimony came the same day as Wisconsin Republican Rep. Jim Sensenbrenner and Vermont Democratic Senator Patrick Leahy unveiled legislation to outlaw the NSA’s bulk data collection program and compel more disclosure from the secret foreign intelligence surveillance court. Several legislators who blocked a prior attempt to outlaw the bulk collection program in July have switched their support to the Sensenbrenner-Leahy legislation.

Monday evening, Democratic Senate intelligence committee chair Dianne Feinstein of California, one of the NSA’s staunchest defenders, said a “full review” of intelligence collection programs was necessary in light of the intel community’s spying on foreign leaders without “satisfactorily” informing Congress.

Despite having a rough week, the NSA still has allies in Congress, especially when it comes to its data collection programs.

Among the divides is whether the NSA has a political problem or a legal one. For the intelligence community and their supporters in Congress, the fallout from leaks facilitated by former NSA contractor Edward Snowden is an issue of public perception. They see what the NSA does as legal and justified, and they think the backlash against NSA surveillance is largely the product of a misleading media narrative.

At one point, Minnesota Republican Rep. Michele Bachmann asked the panel whether they believed Snowden was a traitor. Three of the four officials, Clapper, Alexander, and Deputy NSA Director Chris Inglis all said that he was. James Cole, a top Justice department official, said he couldn’t answer because his response might affect a potential future prosecution of Snowden.

The NSA’s critics in Congress see the agency as having misled both the public and Congress about the scope of its activities, which go far beyond the legal limits Congress established in the aftermath of 9/11. Collecting everyone’s communications data, even if the NSA “looks” at it only occasionally and under strict supervision–as they claim–is still a violation of Americans’ privacy.

Both sides also have a different understanding of what reform looks like. There is some overlap. Both critics and supporters of the NSA are considering proposals to declassify significant foreign intelligence surveillance court opinions and add a privacy advocate who would argue against the government’s requests before the secret court. Even Alexander signed onto the idea of greater transparency for the FISA court.

But the two sides diverge on the most controversial and significant revelations that emerged from the Snowden leaks: whether to end the bulk collection of Americans’ communications data under Section 215 of the Patriot Act, which Alexander claims would lead to another terrorist attack in the United States. Rogers and Feinstein want to keep it, Sensenbrenner and Leahy want to see it go.

The panel of top national security officials seemed receptive to a suggestion from Maryland Democrat Rep. Dutch Ruppersburger that the data collection program be restructured so that private companies hold onto the data. But privacy advocates argue that wouldn’t solve the problem, which is the government essentially having access to everyone’s data.

Yet some changes to US surveillance policy now seem inevitable–fueled in part by congressional frustration with the intelligence community over not being properly informed about spying activities.

“Why did we not know that heads of state were being eavesdropped on, spied on?” Illinois Democratic Rep. Jan Schakowsky asked the panel. “There are going to be changes.”