A lush community garden in East New York, Brooklyn, which was locked after the authorities discovered marijuana plants growing among the stone fruit trees and collard greens, will reopen possibly as soon as this week, city officials said.

The Green Gem garden was coaxed to life from a barren patch of New York City-owned land on Glenmore Street by James McCrae, a custodian at a medical center who founded it and has been its steward for more than two decades. Green Gem’s troubles began two years ago when inspectors from the parks department discovered several violations, the most egregious of which was a marijuana sapling hidden under a rain barrel. Then, last year, a few immature marijuana plants were found growing in coffee cups.

Mr. McCrae, 60, said the illicit plants were the work of a rogue gardener who was no longer part of the garden. But on May 31, Green Gem was ordered shut. As is typical with the city’s 600-plus community gardens, Mr. McCrae had been permitted to run the garden through the parks department’s Green Thumb program. As a result of the violations, his license to operate it was revoked.

All summer, the garden’s loyal growers, many of them immigrants for whom the grassy lawn, rows of corn and furry rabbits were reminders of countries left behind, watched from folding chairs on the sidewalk as the garden filled with litter, and the fruits of several decades of labor withered on the vine. They were let in periodically to clean up the garden, Mr. McCrae, who is known in the neighborhood as Mr. James, said.