For a few days this month, a little library in New England ignited an outsized squabble between law enforcement and civil libertarians.

The Lebanon, N.H., library had announced plans to dedicate its computers to the Tor network, which enables users to surf the Web without anyone knowing who they are. The Tor browser takes people to the dark Web, the wildest territory of the Internet, where users can exchange information in total anonymity.

Supporters of Tor call it a crucial means of ensuring free speech and defeating censorship and repression worldwide. Critics say Tor allows terrorists, child pornographers and drug dealers to operate with impunity.

After hearing about the library's plan, a Department of Homeland Security agent alerted the local police, who in turn contacted the library to express their concern. The Lebanon library said it would drop out of Tor but changed its mind once again after an outcry by defenders of online expression.

The library could be forgiven if it thought it was doing something entirely innocent. After all, the government has supported the anonymous Web service from the start.

The U.S. Navy launched Tor a decade ago. The National Science Foundation and the Department of State spend millions on it.

Meanwhile, the National Security Agency, the FBI and the Department of Homeland Security have emphasized its exploitation by criminals.

"We recognize that any security technology can be used for good or evil," said Jeremy Epstein, lead officer for the NSF's secure and trustworthy cyberspace program. "It's our goal to support the best science."

One of the top recipients of federal funding for Tor development is the University of Minnesota, where researchers have landed $1.6 million in NSF grants since 2009 to study and improve anonymous Web browsing, records show.

Tor is an abbreviation for "the onion router," and the onion represents the layers of encryption that protect the identities of Tor users. Tor depends on a volunteer network of computers, called relays, that carry Internet traffic and ensure that the originating computer cannot be tracked.

Tor has been credited with enabling political dissidents in authoritarian countries to avoid detection and access suppressed information. It was also the browser of choice for Silk Road, the online marketplace for narcotics that was shut down in 2013.

The links on one Tor-accessible website offers a window on its contradictions: dozens of bitcoin schemes, hackers for hire, credit cards for sale, but also leaked government documents.

"The use of a Tor browser is not, in and of itself, illegal," Shawn Neudauer, a spokesman for the department's Homeland Security Investigations, said in a statement last week. But "the protections that Tor offers can be attractive to criminal enterprises or actors and HSI will continue to pursue those individuals who seek to use the anonymizing technology to further their illicit activity."

Homeland Security denies that it was pressuring the Lebanon library to abandon Tor. But Parker Higgins, a spokesman for the Electronic Frontier Foundation, called it a "scary thing" in the context of the government's efforts to break through the encryptions that Tor and other sites set up.

"Fortunately, it looks like that's not carrying the day," said Higgins, whose California-based group advocates for anonymous Internet use and collected petitions to support the Lebanon library. "There really is a community of people out there who understand why libraries are committed to privacy."

Nicholas Hopper, an associate professor of computer science at the University of Minnesota, is the main researcher for the Tor-related NSF grants. Hopper was drawn to the project because of his interest in Internet censorship, but his research focuses on the technical aspects of the poorly understood world of anonymous browsing.

The government's mixed signals on Tor don't surprise him. Even as their agencies have criticized Tor, intelligence agents have said they couldn't do their jobs without it, Hopper said.

The Tor Project's website states "Normal people use Tor." Children surfing the web without alerting predators. People researching sensitive subjects. Consumers avoiding corporate snooping.

Tor won't tell you who they are, though.

Contact James Eli Shiffer at james.shiffer@startribune.com or 612-673-4116.