But he also found trouble when he took part in efforts to release information to the public that he felt should be freely available. In 2008, he took on PACER, or Public Access to Court Electronic Records, the repository for federal judicial documents.

The database charges 10 cents a page for documents; activists like Carl Malamud, the founder of public.resource.org, have long argued that such documents should be free because they are produced at public expense. Joining Mr. Malamud’s efforts to make the documents public by posting legally obtained files to the Internet for free access, Mr. Swartz wrote an elegant little program to download 20 million pages of documents from free library accounts, or roughly 20 percent of the enormous database.

The government shut down the free library program, and Mr. Malamud feared that legal trouble might follow even though he felt they had violated no laws. As he recalled in a newspaper account, “I immediately saw the potential for overreaction by the courts.” He recalled telling Mr. Swartz: “You need to talk to a lawyer. I need to talk to a lawyer.”

Mr. Swartz recalled in a 2009 interview, “I had this vision of the feds crashing down the door, taking everything away.” He said he locked the deadbolt on his door, lay down on the bed for a while and then called his mother.

The federal government investigated but did not prosecute.

In 2011, however, Mr. Swartz went beyond that, according to a federal indictment. In an effort to provide free public access to JSTOR, he broke into computer networks at M.I.T. by means that included gaining entry to a utility closet on campus and leaving a laptop that signed into the university network under a false account, federal officials said.

Mr. Swartz turned over his hard drives with 4.8 million documents, and JSTOR declined to pursue the case. But Carmen M. Ortiz, a United States attorney, pressed on, saying that “stealing is stealing, whether you use a computer command or a crowbar, and whether you take documents, data or dollars.”

Founded in 1995, JSTOR, or Journal Storage, is nonprofit, but institutions can pay tens of thousands of dollars for a subscription that bundles scholarly publications online. JSTOR says it needs the money to collect and to distribute the material and, in some cases, subsidize institutions that cannot afford it. On Wednesday, JSTOR announced that it would open its archives for 1,200 journals to free reading by the public on a limited basis.