New York City on Wednesday banned the use of chewing tobacco at sports venues such as Yankee Stadium and Citi Field, joining other cities in discouraging Major League Baseball players from a habit with deep roots in the game.

Mayor Bill de Blasio signed into law an immediate prohibition on the use of smokeless tobacco at sports and recreational areas that issue tickets. Wednesday night's game at Yankee Stadium was affected.

"Our youth nationwide look up to the athletes in that spotlight. With Intro. 1068-A, we are taking a huge step forward to ensure that our youth are not exposed to dangerous practices," de Blasio said in a statement.

The Yankees publicly supported the initiative, which follows similar ones passed in Boston, Chicago, Los Angeles and San Francisco. The state of California has a statewide ban due to take effect next year, affecting stadiums in Anaheim, Oakland and San Diego as well.

When professional baseball emerged in America the 19th Century, chewing tobacco was already one of its customs, and the habit remains popular.

Professional baseball banned "chew" in the minor leagues in 1993, but it has been allowed at the big league level. The Major League Baseball Players Association has considered any rules to be a matter for collective bargaining.

Some restrictions were added to the collective bargaining agreement negotiated in 2011. Players no longer carry tins in their back pocket nor do they chew during televised interviews, and the union has agreed to help players quit.

The issue took on urgency after Hall of Fame player Tony Gwynn died of salivary gland cancer in 2014 at age 53. Gwynn had said he was convinced chewing tobacco caused his cancer.

The players union and MLB are negotiating a new contract as the existing one expires this year.

(Reporting by Daniel Trotta; Editing by Toni Reinhold)