Sheryll Durrant left her family farm in Jamaica in 1989 and embarked on a career in corporate marketing. But after the 2008 financial meltdown, she reconsidered her life.

She returned to her roots.

Now she runs a thriving urban farm wedged into a triangular plot in the Bronx, between the Grand Concourse and the Metro North railroad tracks. At her farm, New Roots Garden, membership consists of refugees and migrants, resettled by the International Rescue Committee, whose herbs and vegetables sustain their memories of home.

“Just putting your hands in soil is a form of healing,” Ms. Durrant, 63, said.

The plot she has managed with volunteers for eight years sits on city land and is among more than 500 community gardens in New York City. About a third of them have sprouted in the Bronx, where the gardens are emerald oases, providing residents a respite from hot, treeless streets clogged with traffic, as well as a bounty of locally grown food.

Lawmakers in Albany this year acknowledged those benefits, especially in the fight against climate change, voting to designate these kinds of gardens statewide as crucial to the urban environment. Passed with strong bipartisan support, the bill awaits the governor’s signature.

“What we do on every small piece of land really does matter,” said Jennifer Bernstein, the chief executive and president of the New York Botanical Garden, which has helped some 400 Bronx gardens since the late 1980s. “These gardens were ahead of their time in recognizing the role nature plays in making cities livable and resilient.”

The bill aims to shield gardens on city land by mandating that regulatory officials consider the possible effects of development and construction when reviewing proposals to build on gardens deemed environmental assets by a statewide task force of gardeners.

While some New York City gardens are protected by being on city parkland or by the backing of well-financed nonprofit groups, those that are otherwise on city-owned land could be displaced by affordable housing. And gardeners and experts fear the possible impact of residential construction on adjoining lots, which could block sunlight to their plots and contribute to the exodus of residents who cannot afford the area’s rising rents.

The urban farmers at New Roots, which Ms. Durrant said sits on land the city had been using as a storage site before becoming a garden, found the bill reassuring.

The gardens represent “more than a vestige of the past. It’s the legacy of that irrepressible human aspiration to be productively engaged,” said Raymond Figueroa, who leads the nonprofit New York City Community Garden Coalition and teaches at Pratt Institute. He added he campaigned for the new protections to add a layer of review he often felt was missing when officials weighed how gardens might be used.

Community gardens began sprouting in New York City as a result of the fiscal crisis of the 1970s, when intrepid urban gardeners reclaimed abandoned and city-owned lots choked with weeds and garbage. Some residents even recreated pastel-colored Caribbean-style casitas where chickens roamed among flowers and vegetables.

Preservation efforts took hold during the Giuliani and Bloomberg administrations, and the pandemic ushered in a new era for the gardens.

“Growing your own food is one of the most revolutionary things you can do,” said Sunny Vasquez, a food and agriculture assistant at New Roots.

Their harvest is as diverse as the city itself: callaloo and pigeon peas, bok choy, and eggplant and hot peppers. One volunteer gardener, Rose Nzada, managed to harvest a few stalks of sugar cane — the kind she nibbled on as a child — which she grew from small pieces she sneaked in years earlier from Cameroon.

“I put it in my luggage,” said Ms. Nzada, 63. “It was sweet.”

The effects of climate change are visible at New Roots, Ms. Durrant said, with tropical crops flourishing in the longer, hotter growing season. But the garden’s raised beds cannot handle the increasingly common downpours, with water overflowing and flooding the dirt paths.

Ms. Durrant championed solutions like collecting rainwater and planting hardier crops that she and her volunteers have devised. “You would think society would want to include that chutzpah in developing our communities and economies,” she said.

The Morning Glory garden in the West Farms section of the Bronx is protected by its location on city parkland, though its gardeners still worry plots like theirs could end up enshadowed by new housing nearby.

Already, they have adjusted in the face of climate change by collecting water in huge barrels for irrigation and treating plant diseases brought on by high humidity.

Cayla Casciani, a volunteer coordinator with her husband, Aazam Otero, has been proactive, and said last year’s heat waves made the increasing challenges clear to anyone who doubts the urgency.

“If that doesn’t make community gardeners realize we have to act, I don’t know what will,” she said. “You have to change how you look at things.”