FRAMINGHAM, Mass. — A yearslong effort to restore the ramshackle Massachusetts homestead where a woman accused of witchcraft during the 1692 Salem witch trials resettled after escaping the hangman’s noose is nearing an end.

A $1.5 million renovation project at the Peter and Sarah Clayes House in Framingham is expected to be completed in the spring.

“This is an amazing piece of national history, and it was just falling apart,” said Annie Murphy, executive director of the Framingham History Center and a member of the Sarah Clayes House Trust, formed several years ago to save the structure. In addition to its connection to the witch trials, the house is thought to have been a stop on the Underground Railroad and once housed Secret Service agents assigned to protect President Franklin D. Roosevelt’s son when he lived nearby.

The home on Salem End Road was privately owned until it was essentially abandoned after a foreclosure around 2000.

It fell into disrepair. Vandals smashed the windows and defaced the interior. The paint peeled, the woodwork rotted and weeds grew waist high in the yard. Local kids who used the building as a party spot called it the “witch house.”

Sarah Clayes, whose last name is sometimes spelled Cloyce, was jailed during the witch trials, which claimed the lives of 20 people, including her sisters Rebecca Nurse and Mary Easty. She was freed in 1693 when the government realized the lunacy of killing innocents over unsubstantiated accusations.

Sarah and Peter Clayes, as well as about 50 members of their extended family, got out of town.

“They wanted to get away from Salem, clearly, as a lot of people did,” said Emerson Baker, a Salem State University history professor and witch trials expert who’s not involved with the effort to preserve the house.

One of the judges during the trials was Thomas Danforth, a former deputy governor of the Massachusetts Bay Colony who owned land about 35 miles southwest of Salem.

“We assume Danforth took pity on Peter and Sarah and offered them the land,” Baker said. Many of the Salem refugees became pillars of the town that in 1700 was incorporated as Framingham.

Probably the only thing remaining – if anything – of the original 1693 house is the rough-hewn stone foundation, Murphy said. But 17th-century maps of the area clearly show the Clayes house at the exact location. The house that still stands dates to 1776.

One of the trust’s first tasks was to figure out who held the mortgage, which during the financial crisis was sold so many times that nobody could figure out who held it.

Attorney and trust member Stephen Meltzer helped trace it to Goldman Sachs Mortgage Co. Goldman Sachs bought the house at auction in 2015 and donated it to the nonprofit Land Conservation and Advocacy Trust, founded to provide legal assistance to help preserve historic places.

The renovations are being financed by several members of the Sarah Clayes House Trust and supervised by Ned Murphy of E.J. Murphy & Co., who has decades of experience restoring historic homes.

The project has been one of the most challenging of his career. So much of the woodwork has rotted that the house sagged and one of his first jobs was to hoist it several inches. The house was expanded several times over the centuries using different construction methods and materials.

“Part of the challenge is just the strangeness of the construction,” said Murphy, who is Annie Murphy’s husband.

When the renovations are complete, the home will be sold to a private buyer, who under preservation laws won’t be allowed to make substantial changes and will also have to open the house for tours one day a year.

Despite the preservation restrictions, Annie Murphy doesn’t anticipate any problems finding a buyer.

“Anybody who buys this house is going to have to love history and they’re not going to want to change anything,” she said.