Massive data collection and surveillance programs at the U.S. National Security Agency are necessary to keep the nation safe from terrorism, several senators said Wednesday.

While some members of the Senate Judiciary Committee called for changes in NSA surveillance programs that would end the bulk collection of U.S. telephone records, others defended the program and a second surveillance program focused on email communications of people outside the U.S.

Ending the collection of telephone metadata in the U.S. would make the U.S. more vulnerable to a 9/11-style terrorist attack, said Senator Dianne Feinstein, a California Democrat and chairwoman of the Senate Intelligence Committee. The NSA's collection of U.S. telephone call information is legal and necessary, she said at a Judiciary Committee hearing.

"Our great strength today, ladies and gentlemen, in protecting this homeland is to be able to have the kind of technology that's able to piece together data while protecting rights," Feinstein said. "I will do everything I can to prevent this program from being cancelled out."

The telephone metadata collection program is not a surveillance program, as widely reported in the media from leaks by former NSA contractor Edward Snowden, according to Feinstein. "There is no [call] content collected by the NSA," she said.

If the telephone records program had been in operation in 2001, there would have been a "very high" likelihood that authorities would have discovered the 9/11 plot before it happened, said General Keith Alexander, the NSA's director.

Several other senators defended the NSA programs, as well as Alexander and James Clapper, U.S. director of national intelligence. "Both of you are trying to do things right to protect our nation," said Senator Lindsey Graham, a South Carolina Republican.

Other senators called for several changes to the NSA's programs. Senator Patrick Leahy, a Vermont Democrat and Judiciary Committee chairman, said he will push for legislation that would end the NSA's bulk collection of U.S. phone records. Leahy is lead sponsor of the FISA Accountability and Privacy Protection Act.

"There have to be limits on the surveillance powers we give to the government," Leahy said. "Just because something is technologically possible, and just because something may be deemed technically legal, does not mean that it's the right thing to do."

The bulk collection of U.S. phone records is illegal because it is not related to criminal activity, said Laura Donohue, director of Georgetown University's Center on National Security and the Law. The program is overly "broad, nonspecific, forward-looking, not tied to a crime and looks to anticipate future acts," she said.

But Clapper said President Barack Obama's administration would oppose legislation that would simply allow Internet companies to report the number of surveillance requests they receive from the NSA and other agencies. Allowing companies to report the numbers of surveillance requests they individually receive would drive terrorists to services not covered by NSA surveillance, he said.

Clapper was prepared to read a statement about a secret NSA pilot program in 2010 and 2011 that would have allowed the agency to collect bulk data about U.S. mobile phone locations, according to a story in The New York Times. But senators didn't ask Clapper about the program, and he didn't volunteer the information during the hearing.

Alexander told the Senate Intelligence Committee last week that the NSA had no plans to collect mobile-phone location information, but he also didn't talk about the pilot program at that hearing.

Alexander also disputed a recent report in The New York Times saying the NSA is tracking social networks to build graphs of the social connections of U.S. residents. The NSA does track social networks to gather information on foreign terrorism suspects, but the report that the NSA was doing the same thing with U.S. residents' social-network data was "flat-out wrong," he said.

Grant Gross covers technology and telecom policy in the U.S. government for The IDG News Service. Follow Grant on Twitter at GrantGross. Grant's email address is grant_gross@idg.com.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.