NEWARK — For years, the project has been little more than a dearly held dream of environmentalists and safe-streets advocates: a nine-mile hiking and biking trail built along a defunct New Jersey rail line that slices through one of the country’s most densely populated regions.

A park in the spirit of New York City’s High Line, the trail would link the state’s two largest cities, Newark and Jersey City, and reach west into the affluent suburbs, crossing two rivers, six more towns and 31 bridges along the way.

The effort has straddled the administrations of two governors, been called by at least two names — Ice & Iron and the Essex Hudson Greenway — and come close to failing more than once.

But last month, after a yearlong negotiation, New Jersey finalized the $65 million purchase of an 8.6-mile stretch of the old Boonton Line from Norfolk Southern Railway. The line travels from Montclair, through Glen Ridge, Bloomfield, Belleville, Newark, Kearny and Secaucus, ending in Jersey City.

State officials formally announced the Aug. 16 land transfer on Thursday.

“This is no longer a question of if,” said Brendan Gill, an Essex County commissioner who has pressed for the greenway for more than a decade. “It is now a question of when.”

Planners have laid out lofty goals: expanding carbon-neutral commuting options; building 130 acres of new parkland in a region starved for open space; providing essential storm-water drainage to ease flooding; and boosting the economies of towns along the way.

But their most ambitious objective may have more to do with building bridges than trails.

Once complete, the greenway will create a barrier-free pedestrian corridor linking cities to suburbs in a state filled with communities and schools largely segregated by race and income.

“You’re taking away a physical and psychological barrier,” said Kim Elliman, chief executive of the Open Space Institute, a land conservation organization instrumental in negotiating the terms of the sale, “and re-establishing a sense of community.”

Mr. Gill, who lives in Montclair, said that was a key reason he remained one of the project’s most active supporters.

The path, he said, will enable people “to be exposed to a world that may be different than theirs, may meet someone who’s different than them, and understand that they’re part of something bigger and larger than just the single individual community that they live in.”

Significant hurdles remain. Consultants who will be hired by the State Department of Environmental Protection will begin the work of drafting a design that appeals to the diverse communities the park will traverse. The state will also have to find ways to pay for and maintain the park.

Work will be done in stages, Gov. Philip D. Murphy said on Thursday, and will not likely be complete until well after the end of his second term in 2025.

“Think of 10 years from now, young kids in one of these communities just wandering safely, in an environmentally friendly way, with confidence, from one community to another, on a bike or walking,” Mr. Murphy, a Democrat, said. “It’s just going to be transformative.”

Parts of the property are narrow and back up directly to private homes. Other segments run under or over roads. In places, the land is as wide as the length of a football field.

“What’s important is to make sure this really meets the needs of the community,” said Debra Kagan, executive director of the New Jersey Bike and Walk Coalition, which, together with the 9/11 National Memorial Trail, spent years building momentum and support for the greenway.

“Where should the access points be? How do we make it so the community members feel welcome?” Ms. Kagan said. “That’s what keeps a project like this really alive.”

Not all towns along the route are equally enthusiastic.

The mayor of Kearny, Alberto G. Santos, said questions he had posed about how the route would be policed, and who would fund any needed emergency response, remained unanswered.

“It looks quite pretty. I hope it happens, just not on the back of Kearny taxpayers,” said Mr. Santos, who was invited to Thursday’s news conference but chose not to attend.

In Kearny, the railway crosses two bridges — both in need of significant repairs — and runs through a tidal marsh along a narrow berm, which Mr. Santos said ambulances and police cars cannot easily traverse.

“Just imagine a dark, unlit rail line in the middle of marsh,” he said. “And if it’s high tide, the water reaches the level of the rail.”

State Senator M. Teresa Ruiz, a Democrat who represents Newark, noted that security and cleanliness along the length of the abandoned railway had long been an issue.

Making an investment in the property, and reducing its desolation, will make the route safer, she said, and cut down on hazardous dumping.

“When this park is brought to the gem it should be,” she added, “it is going to be an extraordinary place for our children to learn the importance of environmental protection and environmental justice.”

Trails built on and near abandoned rail lines have become increasingly common urban attractions. There’s the BeltLine in Atlanta, the Underline in Miami and the 606 in Chicago.

In New Jersey, trains have not run on the line, first chartered as the Montclair Railway Company in 1867, since 2002. The corridor was also once used by Western Union and other telephone companies to bring service into northern New Jersey, said Connor Spielmaker, a spokesman for Norfolk Southern.

One possibility for generating revenue for park maintenance could be leasing portions to telecom companies hoping to lay underground fiber optic cables, according to planners with the Open Space Institute, who helped establish a valuation for the land before it was sold.

“We have to change the way we’re doing things,” Ms. Kagan said. “And one of the ways to do that is to be serious about building safe, accessible, active transportation infrastructure.”