CAUGHT IN THE ‘HACK’: Aaron Swartz is captured on camera sneaking into an MIT computer room, where he accessed a school database.

CAUGHT IN THE ‘HACK’: Aaron Swartz is captured on camera sneaking into an MIT computer room, where he accessed a school database. (
)

A former lawyer for Reddit co-founder Aaron Swartz, who hanged himself in his Brooklyn apartment Friday, says he told federal prosecutors nearly a year ago that the fragile Internet genius might kill himself.

“Their response was, ‘Put him in jail. He’ll be safe there,’ ” said Boston attorney Andrew Good, who represented Swartz in a federal hacking case last year before a new legal team took over.

The revelation comes as Swartz’s shattered family prepares for his funeral today in Highland Park, Ill. — and as friends and mentors slammed US prosecutors for their aggressive pursuit of the Internet activist in the case.

Swartz, 26, faced up to 50 years and millions in fines after Boston prosecutors, led by US Attorney Carmen Ortiz, charged in 2011 that he illegally downloaded millions of articles from JSTOR, a free database of academic papers at the Massachusetts Institute of Technology.

Swartz had been in on-and-off talks for a plea deal, but prosecutors insisted he plead guilty to all 13 charges against him, said his new lawyer, Elliot Peters.

Peters said he asked the feds last Wednesday to “find a way to resolve the case that didn’t destroy Aaron’s life.”

Prosecutors wouldn’t budge. Swartz, his bank account nearly drained from the fight, was facing an April trial.

“He couldn’t bear to be labeled a felon,” Lawrence Lessig, who runs Harvard’s Edmond J. Safra Center for Ethics, where Swartz was once a fellow, wrote on his blog yesterday.

“For 18 months of negotiations, that was what he was not willing to accept,” Lessig blogged.

Swartz, Lessig said, was “driven to the edge by what a decent society would only call bullying.”

“I know a criminal hack when I see it, and Aaron did not hack into that system,” Stamos told The Post. “He accessed a system that MIT, by its own admission, intentionally made available to those connected with the school. You could download as much as you wanted.”

The document is an e-mail in which a Secret Service agent notes that the feds had no search warrant for a computer, drives and other items seized as evidence by local police. Prosecutors countered in papers of their own on Friday that the e-mail “is not nearly as important at [Swartz] makes it out to be.”

An online petition asking President Obama to fire US Attorney Ortiz had nearly 20,000 signatures late yesterday.

A spokeswoman for Ortiz yesterday declined comment, saying, “We would like to respect the family’s privacy.”