Amid the modern apartments and trendy shops that have transformed Patchogue, the formerly struggling village has welcomed back a treasured part of its past.

The century-old Carnegie Library reopened on Oct. 17 after being moved twice and undergoing a $1.5 million renovation. The library, which includes a youth center and space for community events, is part of the Patchogue-Medford Library system.

The building — originally commissioned by philanthropist Andrew Carnegie as part of a campaign to build libraries across the country — almost became a victim of the village’s efforts to modernize. It was saved from the wrecking ball and has been restored to the way it looked when it opened in 1908.

Mayor Paul Pontieri said the library is an “anchor” that ties the village’s future to its past.

“To be able to keep a piece of that history . . . meant a lot to the community,” Pontieri said. “Progress doesn’t always mean destroying the past.”

The library originally sat on Lake Street and served as Patchogue’s public library until the Patchogue-Medford Library opened on Main Street in 1981. Briarcliffe College took over Carnegie and used it until 1998.

advertisement | advertise on newsday

For more than a decade after that, Carnegie remained vacant and was in danger of being lost to history as new residential and retail buildings were constructed throughout Patchogue.

Village officials and a community group, Friends of Carnegie Library, crafted a plan to move the building and restore it using state funds and a grant from the Knapp Swezey Foundation, a Patchogue nonprofit.

Librarians, Charlotte Latuso, Michele Cayea, and Colleen Hutchens, demonstrate a learning activity for kids at the Carnegie Library in Patchogue, on Nov. 1, 2016. The restored library operates as the Patchogue Medford Library's teen center. Photo Credit: Newsday / Thomas A. Ferrara

The 334-ton building was moved twice: first to a spot behind Sixth District Court on Main Street, and then to its permanent home on the southeast corner of Main Street and West Avenue.

Architects used archival photographs to restore original wood floors, ceilings and handrails. Lighting fixtures matching the library’s original chandeliers were installed, and replica lamps were erected outside. New Greek-style columns were made for the library’s interior.

To replace a sculpture that once sat above the main entrance before it went missing, the library hired Long Island artist Mel Zapata to create a replica, which now adorns the space where the old one had been.

Since it reopened, some patrons have shared stories of receiving their first library cards at the Carnegie before it closed, library director Lauren Nichols said. Many visitors, she said, have enjoyed “looking around and they seem so serene.”

The library contains books geared for teenagers, and library officials plan to offer college counseling services. Adult yoga and tai chi classes are held there, and the Greater Patchogue Historical Society is developing a community museum in the basement.

Assistant library director Danielle Paisley said she thinks the library will be an “inspiration” to its teenage visitors.

advertisement | advertise on newsday

“The place is so beautiful,” Paisley said. “This is a place where you really sit and ponder how something was created over the years and hopefully it inspires them to create new stuff.”