A long-planned biking and walking trail stretching 10 miles across two Suffolk towns will be complete by 2018, lawmakers said Tuesday.

Rep. Lee Zeldin (R-Shirley) joined local officials in Miller Place to announce the progress made in the $9.5 million effort.

The project, originally proposed in 2001 as part of the federally funded Rails to Trails Conservancy, would transform a 10-mile long expanse of land, over which Long Island Rail Road tracks once ran, into a trail that would stretch across six Suffolk hamlets — Port Jefferson Station, Mount Sinai, Miller Place, Sound Beach, Rocky Point, Shoreham and Wading River.

The federal government earmarked 80 percent of the funding for the effort years ago, but several political and regulatory obstacles stalled the project more than a decade.

With the money “in danger of being rescinded and repurposed,” Zeldin said he and other federal lawmakers, including Sen. Chuck Schumer (D-N.Y.), worked to keep the project alive until New York State finally approved the project as part of its just-passed five-year transportation capital plan.

“We knew we had to make sure we got this done,” Zeldin said. “We wanted to make sure we didn’t lose the money to some other project somewhere else in New York.”

Zeldin and other elected officials said the trail will benefit both Suffolk’s environment, by getting some cars off the road, and its economy by bolstering the county’s “eco-tourism” appeal.

advertisement | advertise on newsday

The trail would go through the planned site of the Tesla Science Center at Wardenclyffe — a museum at a former laboratory in Shoreham once used by famed electrical engineer and inventor Nikola Tesla.

“We always thought this represented the opportunity . . . to connect our communities. Rocky Point to Miller Place. Sound Beach to Miller Place to Rocky Point. All of a sudden we open up all these other areas that we normally wouldn’t be able to get to or we’d have to drive to,” Miller Place Civic Association President Woody Brown said. “What we end up doing is building community.”

Bob Devito, president of the Suffolk County Bicycle Riders Association, said the project would also provide a safe and much-needed new trail for cyclists on Long Island.

“It’s really taken too long to come to fruition,” Devito said. “But now that it has, it’s a wonderful thing.”