Former Deputy Attorney General James Comey on Tuesday provided dramatic new details of an internal Justice Department rebellion against the White House’s warrantless surveillance program in 2004 and told Congress that the White House had briefly reauthorized the program over the objections of the government’s top legal officials.

In a hearing before the Senate Judiciary Committee, Comey told senators of an extraordinary White House effort to circumvent him in seeking reauthorization for the secret eavesdropping program while Comey was serving as acting attorney general. At that time, in March 2004, then-Attorney General John Ashcroft was in intensive care while being treated for gallstone pancreatitis and had temporarily relinquished his powers to Comey.

Comey, who was Justice’s No. 2 official from December 2003 to August 2005, came to testify before the panel about his views on the controversial firings of at least eight U.S. Attorneys last year, but instead spoke at surprising length about the White House’s effort to bypass him on the secret program. Comey avoided naming the specific program during the hearing, though senators of both parties made clear they understood Comey to be referring to the National Security Agency’s warrantless surveillance program.

Comey explained that, in Ashcroft’s absence, he had refused to sign a presidential order reauthorizing the National Security Agency’s program, citing unspecified concerns about its legality raised by the Justice Department’s Office of Legal Counsel.

In response, Comey testified, then-White House Counsel Alberto Gonzales and then-White House Chief of Staff Andrew Card Jr. paid a visit to Ashcroft’s bed in the intensive care unit at George Washington University hospital in Washington, D.C., and attempted to get a still-groggy Ashcroft to overrule Comey. Comey, who testified that he had “raced” to the hospital with his security detail to arrive at Ashcroft’s bedside before Gonzales and Card, said that Ashcroft refused Gonzales’ request to overrule Comey and that Ashcroft indicated that only Comey could provide such authorization.

“I was very upset. I was angry,” Comey testified in response to questioning from Sen. Charles Schumer, D-N.Y. “I thought I’d just witnessed an effort to take advantage of a very sick man who did not have the powers of the attorney general.”

Comey and FBI Director Robert Mueller were so concerned that the White House was trying to circumvent the Justice Department that, before Gonzales and Card’s arrival at the hospital, Mueller instructed FBI agents not to allow Comey to be removed from Ashcroft’s bedside “under any circumstances,” Comey said.

The former deputy attorney general went on to say that the White House reauthorized the NSA’s program without the approval of the Justice Department, a move which led Comey to draft his resignation letter. “I believed that I couldn’t stay if the administration was going to engage in conduct that the Department of Justice said had no legal basis,” Comey said.

Comey said he believed that a number of other top Justice officials were prepared to resign along with him, including Ashcroft, Mueller and Ashcroft’s chief of staff, David Ayres.

Comey’s description of the rebellion drew stunned looks from the senators. “It has some characteristics of the Saturday night massacre,” said Sen. Arlen Specter, R-Pa., the committee’s ranking member, in a reference to the resignations of Attorney General Elliot Richardson and Deputy Attorney General William Ruckelshaus during the Watergate scandal.

But Comey did not resign, he said, in part because the Madrid train bombings occurred that week in mid-March 2004, demanding a renewed focus on terrorism concerns. He went on to say that both he and Mueller had separate private meetings at the White House with President Bush, in which Bush instructed them to make such changes in the program as they deemed necessary to make it comply with the law. Comey said that the Justice Department was allowed to do so, and that process took approximately two to three weeks. Bush’s decision was made despite the objections of Gonzales, Card, Vice President Dick Cheney and Cheney’s then-general counsel, David Addington, Comey said.

Through spokespeople, both Ashcroft, now a lobbyist, and Mueller declined to comment.

Earlier this year, the Justice Department announced that surveillance previously conducted pursuant to the National Security Agency’s program had been brought under the purview of the Foreign Intelligence Surveillance Court.

After Comey’s testimony, a Justice Department spokesman issued a statement saying: “We cannot comment on internal discussions that may or may have not taken place concerning classified intelligence activities. The Terrorist Surveillance Program was a vital intelligence program that helped detect and prevent terrorist attacks. It was always subject to rigorous oversight and review.”

During Tuesday’s testimony, Comey was silent on his views of Gonzales’ tenure atop the Justice Department. Asked by Sen. Herb Kohl, D-Wis., to share his opinion of Gonzales, Comey responded: “I would very much like not to. … I’m not here to dump on Attorney General Gonzales.”

Comey and Ashcroft also drew praise from Sen. Russell Feingold, D-Wis., who had repeatedly clashed with them over powers granted in the USA Patriot Act. “There is a difference in this administration between people like you and Attorney General Ashcroft, who fundamentally respect the rule of law,” and others who don’t, Feingold said, implying that he included Gonzales in the latter group.

Earlier in the day, Gonzales addressed the controversy surrounding the firings of the U.S. Attorneys by seeking to shift responsibility for the selection of those to be fired to Deputy Attorney General Paul McNulty, who announced his resignation Monday. After a speech at the National Press Club Tuesday morning, Gonzales said that the selection of the U.S. Attorneys to be fired “in particular reflected the views of the deputy attorney general.” Gonzales emphasized that after the outcry over the firings and scrutiny about whether they were dismissed for inappropriate political reasons, he went to McNulty to see if the decision should be reversed. McNulty said no, Gonzales said, and as the direct supervisor of the U.S. Attorneys, “he would know better than anyone else.”

But at the Senate hearing after Gonzales’ speech, McNulty drew praise from Specter, who continues to be openly contemptuous of the attorney general. “I think he found it difficult — really, impossible — to continue to serve in the Department of Justice as a professional, which Paul McNulty is, because it’s embarrassing for a professional to work for the Department of Justice today,” Specter said in his opening remarks.