A remarkable document released by The Guardian gives the public its first in-depth look at the legal process that justified the dragnet surveillance programs undertaken during President George W. Bush's first term. And they make clear that lots of people involved in the process — government lawyers, judges, and the lawyers of private telecommunications companies — believed the Bush administration had stepped over the legal line.

Former President George W. Bush. (Chip Somodevilla — Getty Images)

The revelations come from a report written by the Office of the Inspector General at the National Security Agency. The document, marked "Top Secret" was leaked to The Guardian by Edward Snowden. It is dated March 24, 2009.

According to the document:

The NSA began targeting communications between the United States and Afghanistan just three days after the terrorist attacks of Sept. 11, 2001. When Vice President Dick Cheney asked whether the NSA could be doing more, NSA director Michael Hayden responded that "nothing else could be done with existing NSA authorities." The NSA found the judicial review process required by the Foreign Intelligence Surveillance Act too cumbersome for the broad-ranging surveillance the agency believed was necessary to keep track of terrorist activities.

But rather than asking Congress to amend FISA, President Bush took the law into his own hands on Oct. 4, 2001. He signed an "Authorization," drafted by vice presidential counsel David Addington, purporting to give the NSA broad authority to intercept telephone and Internet communications if at least one party to the communication was located outside the United States.

The White House Office of Legal counsel wrote a legal opinion defending the legality of wiretapping based on Bush's Authorization. The White House refused two requests by NSA lawyers to see this document, though Addington did "read a few paragraphs of the opinion" over the phone to NSA General Counsel Robert Deitz. The NSA's inspector general stated that he found it "strange that NSA was told to execute a secret program that everyone knew presented legal questions, without being told the underpinning legal theory."

The surveillance required the assistance of private-sector telecommunications companies. While some firms readily agreed to participate, others balked at the idea of violating their customers' privacy without a court order. The report discusses the NSA's discussions with seven firms labeled "Company A" through "Company G." Companies A through D participated in the NSA program. "The Company E General Counsel ultimately decided not to support NSA." Company F "did not participate because of corporate liability concerns." The NSA dropped Company G from the program after it insisted on consulting outside counsel before agreeing to participate.

The report says that the Foreign Intelligence Surveillance Court was not even informed about this secret surveillance until Jan. 31, 2002, more than three months after the program began. After Judge Colleen Kollar-Kotelly was sworn in as the Chief Judge of the FISC in May 2002, she was briefed on the program and allowed to read a memo summarizing the White House's legal justification, but she was not allowed to "retain it for study."

In March 2004, the Office of Legal Counsel at the Department of Justice concluded that one part of the NSA's surveillance program "was prohibited by the terms of FISA and Title III." Attorney General John Ashcroft and his deputies resisted White House pressure to sign off on the program. But rather than shut down that aspect of the program, the President had the White House Counsel sign an Authorization for the program, instead of the Attorney General, on March 11.

Eight days later, President Bush changed his mind and ordered the collection of bulk Internet metadata halted. Collection resumed in July, after the government convinced Judge Kollar Kotelly to sign off on a new legal justification for the program.

Three other surveillance programs — dealing with telephone metadata and the content of phone calls and Internet communications — were allowed to continue after March 2004. But under pressure from the Department of Justice, the White House began looking for new legal foundations for these programs. "DOJ and NSA needed to find a legal theory that would allow NSA to add and drop thousands of foreign targets for content collection. Beacuse the law was more restrictive for content than metadata, NSA had serious reservations about whether it would be possible to find a workable solution using a FISC order at that time."

Finally, DoJ lawyers found a solution. The FISC grants orders based on "facilities," which were traditionally phone numbers or e-mail addresses. But the DoJ convinced the FISC that a "facility" could also be a "gateway or cable head that foreign targets use for communications." In other words, rather than seeking a court order for each individual target, the NSA sought permission to intercept the communications of thousands of people with a single FISA order.

The Inspector General says it took "18 months of concerted effort and coordination" to convince the FISC to sign onto this creative interpretation of the law with respect to foreign targets. The court rejected this interpretation of the law when the government was targeting Americans, forcing the government to begin seeking conventional FISA orders to intercept Americans' international communications.

After more than a decade, opponents of Bush's surveillance programs have still not had an opportunity to challenge them in court. But the sheer number of people who raised concerns, including company lawyers, Department of Justice lawyers, and the FISC itself, suggests the Bush-era spying programs were on shaky legal ground. Lawyers at the Department of Justice are not known for their devotion to civil liberties, yet several of them apparently believed that the White House had stepped over the line.