HOLYOKE -- The long-closed Mater Dolorosa Church will avoid the wrecking ball after all, with the city announcing Thursday that it will buy the 117-year-old building.

Mayor Alex B. Morse and Bishop Mitchell T. Rozanski, of the Roman Catholic Diocese of Springfield, made the announcement about the $50,000 purchase at City Hall, concluding negotiations Morse began in October to save the church.

The city plans to use the facility at Maple and Lyman streets to house a transition program for special needs students and to hold banquets and other events, officials said.

The Diocese owns the church at 71 Maple St. It was closed in 2011 because of declining parishioner numbers and concerns about the steeple's stability, diocese officials said, though others have said the church structure is sound and will last for years.

In closing the church, the diocese combined Mater Dolorosa with the former Holy Cross Church to form Our Lady of the Cross at 23 Sycamore St.

Attendance issues aside, opponents of demolition say Mater Dolorosa Church is special, having been built and paid for by Polish immigrants in 1901.

Controversy erupted immediately after the closing, with parishioners occupying the church in round-the-clock vigils for a solid year. They said they distrusted the claims of diocese officials that there were no plans to demolish the church.

Friends of Mater Dolorosa and parishioners appealed the closing to the Supreme Tribunal of the Apostolic Signatura in Rome, the Catholic Church's highest court. That court ruled in 2015 the church officially could close.

After diocese officials said pieces of the steeple had broken off and fallen to the ground, they sought permission from the city to take down the church in January 2017.

Instead, Holyoke Building Commission Damian J. Cote said demolition didn't have to be inevitable. He referred the matter to the city Historical Commission.

Cote also said that whatever weaknesses might be evident in the structure were at least partly because the Diocese had failed to continue with routine maintenance.

In October, the diocese obtained a permit from the city Building Department to demolish only the steeple part of the church.

At the same time, the Holyoke Local Historic District Commission had scheduled a public hearing for Oct. 30 to consider a proposal filed by City Councilor Michael J. Sullivan to make the church a historic district. Such a designation was intended to prevent the diocese from demolishing the church.

That's when Morse began talks with Rozanski.

Acquisition of a property and appropriation of money for the purchase require City Council approval.