A maple syrup smell that has mysteriously wafted through New York City numerous times over the years has been traced to a New Jersey facility that processes fenugreek seeds for flavorings.

The sweet odor has drifted through swaths of the city on at least nine separate occasions since 2005, perplexing New Yorkers and city officials.

Mayor Michael Bloomberg said that a team of odor investigators "put our noses to the ground" to identify the culprit after another whiff in early January.

The investigation involved mapping the time and place of all the odor complaints to the city's 311 hot line, which were then compared with wind and atmospheric conditions.

Those were checked against air sampling tests during the periods that New Yorkers reported smelling the odor.

Officials found that the highest concentration of calls often came from the Upper West Side of Manhattan, and that the odor reports tended to come on days when wind speed was moderate — meaning that it was fast enough to carry odors but slow enough that they were not immediately dispersed.

Investigators also found that the wind on the days in question generally moved from west to east, and narrowed the search to facilities in New Jersey that process food additives and fragrances.

Bloomberg said the odor has only been detected by New Yorkers a small number of times because the conditions apparently had to be quite specific.

"You have to have a day with winds at the right speed, going in the right direction, and high humidity, but no rain," he said.

The probe found that one facility in Hudson County was processing fenugreek seeds on the evening of Jan. 29, when multiple odor complaints came in.

New Jersey and city officials say the facility, operated by a company called Frutarom, does not appear to be violating any rules or regulations. "We are officially closing the case," Bloomberg said.

Fenugreek is a common ingredient in curry powders, and its extract is also used in artificial vanilla, caramel, butterscotch and maple flavorings.