Top US intelligence officials tried to reassure senators and the American public on Thursday that the secret collection of telecommunications metadata and other surveillance techniques used by the National Security Agency had operated legally and within the bounds of constitutional protections.

James Clapper, the director of National Intelligence, told the Senate Intelligence Committee during an unusual public hearing that he was aware that leaks about the NSA program and media coverage of the resulting controversy had “led to a lowering of trust in the intelligence community.”

“We operate within a robust framework of strict rules and rigorous oversight involving all three branches of government,” he told the senators.

Later in the hearing, Sen. Ron Wyden (D) of Oregon, a critic of the surveillance program, questioned Gen. Keith Alexander, director of the NSA, about whether the spy agency had ever collected or planned to collect data revealing the locations where Americans used their cellphones.

General Alexander responded that the NSA was not receiving cell site locational data and had no current plans to do so.

“That’s not the question I’m asking,” Senator Wyden said. “I’m asking, has the NSA ever collected or ever made any plans to collect American cell site information?”

Alexander suggested that he had already answered the question. Then he added: “What I don’t want to do, senator, is put out in an unclassified forum anything that’s classified here.”

“General, if you’re responding to my question by not answering it, because you think that’s a classified matter, that is certainly your right,” Wyden said. He said he would continue to press for an answer. “I believe this is something the American people have a right to know,” he said.

Earlier this year, Wyden asked Clapper whether the NSA was collecting telecommunications data from millions of Americans. Clapper assured the senators it was not.

But he had to backtrack after leaks in June by former NSA contractor Edward Snowden revealed extensive bulk collection efforts by the US government.

The Senate hearing came as several senators are promoting legislation to reform the way US intelligence is collected and overseen.

Both Clapper and Alexander told the senators they would work with lawmakers to enact any necessary reforms.

As part of an apparent public relations campaign, Clapper has ordered the release of a series of documents about the surveillance programs to try to shore up public support.

Alexander repeated Clapper’s claim about inaccurate press accounts. He said news accounts had suggested there had been 2,776 privacy violations under the secret surveillance system. In fact, he said, 75 percent of those cited instances of a violation involved the intelligence agency breaking off surveillance because the target had traveled to the US.

Under rule of the Foreign Intelligence Surveillance Act, the NSA must confine its collection efforts to persons outside the US. Once a target enters the US, the surveillance is handed over to the Federal Bureau of Investigation.

Alexander said there had been only 12 substantiated cases of willful violations at the NSA during the past decade. He said several of the cases were referred to the Justice Department for possible prosecution, and that others were disciplined within the agency.

The NSA director told the senators that the agency’s programs had disrupted 54 terror-related events, including 25 in Europe, 11 in Asia, five in Africa, and 13 in the US.

“This was no accident. This was not coincidence,” he said. “These are the direct results of a dedicated workforce, appropriate policy, and well-sculpted authorities created in the wake of 9/11 to make sure 9/11 never happens again.”

The general said that had the NSA program been operative in the spring and summer of 2001, US intelligence would have likely identified the 9/11 terror plot before it was carried out. “That’s my personal opinion,” he said.

Wyden praised Intelligence Committee Chairman Dianne Feinstein (D) of California for holding an open hearing to facilitate public debate over the sensitive subject.

But he was critical of Clapper and Alexander for what he said was failure to deal truthfully with the American public. “The leadership of your agencies built an intelligence collection system that repeatedly deceived the American people,” he said. “Time and time again, the American people were told one thing about domestic surveillance in public forums while government agencies did something else in private.”

“Now these secret interpretations of the law and violations of the constitutional rights of Americans has become public,” Wyden said. “There’s been loss of trust in our intelligence apparatus here at home and with friendly foreign allies.”

Wyden added: “This could have been avoided if the intelligence leadership had been straight with the American people and not acted like the deceptions that were practiced for years could last forever.”