The Justice Department granted immunity to Hillary Clinton lawyer Cheryl Mills in order to gain access to a laptop computer that would have otherwise been tied up in litigation for years, FBI Director James Comey testified Tuesday.

“Having done this for many, many years, a grand jury subpoena for a lawyer’s laptop would likely entangled us in litigation over privilege for a very long time,” Comey told Nebraska Sen. Ben Sasse during a Senate Homeland Security Committee hearing.

“And so by June of this year I wanted that laptop, our investigators wanted that laptop, and the best way to get it was through negotiation.”

The decision to grant Mills immunity, which was revealed on Friday, has causes massive criticism of Comey and his investigation into Hillary Clinton’s private email server.

Many commentators wondered what was the point of seeking the immunity (as well as that of four others interviewed as part of the probe) if no charges were to be brought against Clinton for mishandling classified information.

“The FBI’s judgment was we need to get to that laptop, we need to see what it is, this investigation’s been going on for a year and this was a tool that her lawyer asked for and that the Department of Justice granted so we could get the laptop,” Comey told Sasse.

He said that the Justice Department wrote Mills’ lawyer a letter granting her active production immunity.

That type of immunity, which is different than personal immunity, protected Mills from prosecution for anything found on the computer.

“Fairly common tool in criminal investigations,” Comey said.

In her role as Clinton’s lawyer, Mills oversaw the 2014 review of the Clinton emails that were eventually given to the State Department. Mills was also in regular contact with technicians working for Platte River Networks, an IT firm that managed Clinton’s server.

One of the technicians, who also received DOJ immunity, deleted backups of Clinton’s emails just before he had a phone conversation with Mills and another Clinton lawyer on March 31, 2015.

While Comey said that there was no evidence that Mills or anyone else obstructed justice, notes from the FBI’s interviews in the investigation show that she was anything but helpful.

As The Daily Caller reported, in 2013, after Clinton left office, Mills asked Bryan Pagliano, Clinton’s personal computer technician, about “wiping computer data.” It is unclear what data she sought to wipe.

Pagliano, who also received DOJ immunity, told the FBI that in 2009 or 2010, he raised concerns to Mills about whether Clinton’s private email system violated the Federal Records Act. Pagliano said that Mills dismissed his concerns. Mills told the FBI that she did not recall the conversation. (RELATED: FBI Notes: Cheryl Mills Asked Clinton Email Technician About ‘Wiping Computer Data’)

Asked if the FBI investigated any instances of obstruction of justice, Comey said that investigators looked into it but found no evidence that any crimes were committed.

WATCH:

Follow Chuck on Twitter