Updated

A broad range of officials including those outside the NSA potentially have access to the agency's bulk phone records, according to newly declassified documents that also show the agency has had "compliance problems" with these databases in the past.

The Office of the Director of National Intelligence on Wednesday released three previously secret documents, just as intelligence officials began to testify on Capitol Hill at a high-profile Senate hearing on government surveillance.

They begin to shed light on how the NSA collects and scours reams of digital data on the phone and email records of millions. The documents once again stress that these programs allow the government to collect basic information about phone calls and email communications, but not the content of those messages. They say most of the information "is never reviewed," while describing the programs as vital to the "early warning system" for detecting terror plots.

But, amid emerging claims that too many people have access to the information -- including lower-level workers and contractors like NSA leaker Edward Snowden -- the documents describe a number of scenarios where people inside and outside the NSA can tap into the information.

One declassified surveillance court order, which according to The Washington Post was an order to Verizon, says that access to phone "metadata" is restricted to "authorized personnel who have received appropriate and adequate training."

At the same time, a footnote says the court understands that "technical personnel responsible for NSA's underlying corporate infrastructure and the transmission" of the data "will not receive special training."

The order goes on to describe how a "store" of information is created, and how trained personnel can query the data using certain criteria and search for "valid foreign intelligence purposes."

That information, the order says, can be shared among properly trained NSA analysts. And from there, top officials including the NSA director can authorize certain information be shared outside of the NSA with other "Executive Branch personnel," provided it is "related to counterterrorism" and sharing it is necessary to understanding that information. This would include federal security agencies like the FBI.

This information, according to the court order, includes "U.S. person identifying information" -- and can be stored for five years.

The document lays out a series of steps that are supposed to be taken to ensure that access to the database remains limited.

But a separate document released Wednesday by the DNI reported that "there have been a number of technical compliance problems and human implementation errors" in programs that collect both bulk phone and email records.

No "intentional or bad-faith violations" were found. The document said only that the missteps resulted in the "automated tools operating in a manner that was not completely consistent with the specific terms of the court's order." Additional safeguards were subsequently ordered by the surveillance court.

Intelligence officials stressed at a Senate committee hearing on Wednesday that the program still does not let them look at content unless there is a reasonable suspicion that the material might be related to terror groups.

Some lawmakers have come down hard on the NSA over these programs, pushing to force the agency to release more information and potentially rein in the program itself.

One of the documents, though, adamantly defended the rationale for collecting massive quantities of "metadata" on phone calls -- like the date, time and duration of calls.

"The more metadata NSA has access to, the more likely it is that NSA can identify or discover the network of contacts linked to targeted numbers or addresses," the document says.