The gardens appeared suddenly along an industrial corridor of Brownsville, Brooklyn — one, two, a half-dozen — as if airlifted from a cul-de-sac upstate.

At first, local residents stopped to inspect the sidewalk oddities. Pictures were snapped and posted on Facebook. At least one young suitor pilfered the contents of a plot and handed them to a girlfriend.

“The dogs use it as a bathroom,” said Stephen Perez, 26, by way of endorsement, as he calmed a 3-year-old husky named Trouble.

Soon, the whole neighborhood knew: At the sensory junction of moldering garbage heaps, a wholesale onion vendor and the crunching aluminum of a scrap yard, there were, apparently, flowers.

Image

Part of the infrastructure for a curbside garden along Junction Boulevard in Queens.CreditRobert Stolarik for The New York Times

What has been largely unknown is why.

In what officials have billed as one of the most ambitious programs of its kind in the United States, New York City has, with little fanfare, embarked on a roughly 20-year, $2.4 billion project intended to protect local waterways, relying in large measure on “curbside gardens” that capture and retain storm-water runoff.

Begun as a pilot program under Mayor Michael R. Bloomberg — about 250 of the gardens are already in the ground — the initiative is set for a major expansion that will bring thousands of gardens to neighborhoods across the Bronx, Brooklyn and Queens in the coming months.

The goal, according to the city’s Department of Environmental Protection, is to soften the “impervious urban landscape” of asphalt and concrete and absorb rainfall that might otherwise funnel into the combined sewer system. (During heavy rain, storm water can exceed the capacity of the city treatment plants. Overflows are discharged into local waterways to avoid flooding the plants, which can harm water quality.)

Any aesthetic benefits from the gardens are effectively seen as a bonus, though officials from Mayor Bill de Blasio’s administration noted that plots would be placed in many neighborhoods with a dearth of trees and above-average rates of asthma among young people.

Image

Valencia Allen-Hazel admired a garden outside the Seth Low Houses on Powell Street in Brownsville, Brooklyn. “If somebody comes down who doesn’t live here, it makes it look better than it actually is," she said.CreditRobert Stolarik for The New York Times

“They make the neighborhood look like — I don’t want to say a better neighborhood,” began Valencia Allen-Hazel, 21, from East New York, Brooklyn, admiring a garden on Powell Street. “If somebody comes down who doesn’t live here, it makes it look better than it actually is.”

Yet as with any addition to New York’s streetscape — bike lanes, pedestrian plazas, the lawn chairs of Times Square — the gardens seem likely to attract the typical urban hazing. Many have already become repositories for trash, critics say. At some two dozen sites visited recently, the detritus included cigarettes, coffee cups, wrappers, a lottery ticket and a miniature vodka bottle, though it was unclear how much had been deposited as litter and how much had been carried there by rain.

The gardens are typically built into sidewalks, with curb cuts that let storm water flow among the shrub roses and black-eyed Susans. Others have taken up street space that might traditionally be used for parking, rankling some residents, but officials say they have tried to avoid this when possible.

Emily Lloyd, the commissioner of environmental protection, cited the example of Janette Sadik-Khan, the former transportation commissioner who reallocated much of the city’s sidewalk and street space, often to the consternation of drivers.

Image

A garden along Junction Boulevard in Queens. The construction of the plots began as a pilot program under the Bloomberg administration; Mayor Bill de Blasio is expanding it.CreditRobert Stolarik for The New York Times

“It gladdens your heart,” Ms. Lloyd said of the addition of green spaces, while leading a walking tour of garden sites near her agency’s office in Flushing, Queens.

In Brownsville, some travelers seemed unsure how to negotiate the additions. Mr. Perez said he had seen cars swerve to avoid one garden that protruded into the street. On a recent afternoon, one driver sidled up to the garden, slowed down to look, then decided against leaving his vehicle next to it.

“Is it illegal to park in front of the flowers?” Ms. Allen-Hazel asked a passing traffic officer from the sidewalk.

“I don’t know,” she said, barely breaking stride. “I wouldn’t.”

Though relatively untested on the scale outlined by the de Blasio administration, similar gardens have proved effective in other cities, most notably Philadelphia, according to advocates and researchers. The push for so-called green infrastructure projects across the country dates to at least 1987, when Congress revised the federal Clean Water Act.

Image

"It gladdens your heart," said Emily Lloyd, the city's commissioner of environmental protection, of the addition of the green spaces.CreditRobert Stolarik for The New York Times

Robert G. Traver, a professor in the department of civil and environmental engineering at Villanova University, said test sites assembled at the university had performed better than expected. “We had sites designed to get rid of an inch, get rid of three or four inches” of water, Dr. Traver said.

Once completed, the administration said, New York City’s gardens are expected to capture more than 200 million gallons of storm water each year that might otherwise run into waterways like the Gowanus Canal, Flushing Bay or Newtown Creek.

The gardens cost roughly $20,000 to $25,000 each. City officials have cast them as an essential expense, particularly given the high cost of a potential alternative for storing excess water. “The traditional way to do it is to build a big tank,” Ms. Lloyd said.

Despite the skepticism, residents seem inclined to give the gardens a chance. In Bedford-Stuyvesant, Brooklyn, where several are going in, some at first surmised that the construction was for the typical fare — an uneven sidewalk, a utility intervention, maybe a bench, at best.

“I never thought they would do something like that,” said Deonna Stevens, 16, who hopes to bring her younger sister and a cousin to the gardens.

She peered at the dark soil beside Macon Street.

“Finally,” she said, “the ’hood is going green.”

A version of this article appears in print on , on Page A16 of the New York edition with the headline: Lining Urban Streets With Gardens to Soak Up What the Clouds Drop. Order Reprints | Today’s Paper | Subscribe