Massachusetts police arrested a former Danvers child psychologist Thursday – after a contractor allegedly found an illicit trove of child pornography stashed in a secret room while renovating his apartment, according to the Essex County District Attorney’s Office.

Mark Ternullo, 68, has been renting an apartment in a multifamily home for more than 20 years, Essex District Attorney Jonathan Blodgett’s office said Thursday. 

The bathroom had sustained "extensive water damage," and the landlady called in a contractor to do repairs.

PHILADELPHIA SWAT OFFICER SHOT IN BULLETPROOF VEST. SUSPECT IN CUSTODY, POLICE SAY

The work entailed taking down a rotting wall.

Stock image: The bathroom had sustained "extensive water damage," and the landlady called in a contractor to do repairs that required tearing down the bad wall.

Stock image: The bathroom had sustained "extensive water damage," and the landlady called in a contractor to do repairs that required tearing down the bad wall. (iStock)

"In doing so, the contractor found a hidden room in which multiple boxes full of pornographic images of children were stored," prosecutors said.

Prosecutors requested $500,000 cash bail, but a judge set it at $10,000, according to prosecutors.

His lawyer, Mark Dewan, sought $1,000, arguing his client suffered from bladder cancer and diabetes, among other health concerns.

He’s due back in court March 7.

The low bail prompted Republican Gov. Charlie Baker to call for legislation that would free up judges to remand child porn suspects.

"It's simple: Anyone arrested for having a secret room filled with child pornography should be kept away from the public + kids," he tweeted Friday. "But current law doesn’t allow a judge to hold someone charged with possession of child pornography. Our bill would change that."

CLICK HERE TO GET THE FOX NEWS APP

The judge ordered Ternullo to remain under house arrest with a GPS location monitoring device and have no contact with children under 18. He also can’t use the internet.

According to The Salem News, Ternullo has previously worked with schools and community organizations.

The Associated Press contributed to this report.