NEW YORK — New York City lawmakers voted Tuesday to ban flavored electronic cigarettes after a lawsuit halted a statewide ban.

“We are acting to protect our kids by banning the e-cigarette flavors that have been hooking them for years,” Democratic City Council member Mark Levine said before the Council voted 42-2 to adopt the ban on flavored vaping products.

Advocates for the vaping industry jeered and threw dollar bills from the balcony after the vote, and industry supporters said the ban will hamper efforts to curb smoking.

“All the New York City Council did today was make it harder for adult smokers to quit, shut down small businesses, and create a new black market that will inevitably lead to Constitutional violations by the New York City Police Department,” Gregory Conley, president of the American Vaping Association, said in a prepared statement.

The measure, which Democratic Mayor Bill de Blasio has said he supports, bans all e-cigarette and e-liquid flavors except tobacco. It is expected to take effect on July 1, 2020.

The legislation is likely to face a legal challenge. Spike Babaian, a vape shop owner and board member of the New York State Vaping Association, said the organization is “pursuing legal options." A 90-day ban on the sale of most flavored e-cigarettes that New York state health officials planned to start enforcing is currently held up after a state appeals court blocked that effort last month when vaping industry representatives sued.

Advocates for the e-cigarette industry say vaping products save lives by helping smokers quit.

Cheryl Richter, executive director of the New York State Vapor Association, said her group represents “hundreds of thousands of consumers who rely on vapor products to keep them from smoking cigarettes in New York.” She called the New York City bill “an overreaching infringement of their constitutional right to choose a product that improves their health.”

The move to ban flavored e-cigarettes comes amid nationwide concern about the growth of teenage vaping and fears about health risks.

Republican President Donald Trump promised two months ago that he would ban most flavored e-cigarettes but later backtracked. He said Friday that his administration would announce a plan to curb teen vaping “very soon.”

E-cigarettes first appeared in the U.S. more than a decade ago and have grown into a multibillion-dollar industry despite little research on their long-term effects.

Researchers generally believe they are less harmful to smoke than cigarettes, which kill hundreds of thousands of Americans annually, and they were initially promoted as a way to help tobacco users switch to something less harmful. But like cigarettes, they contain nicotine and are highly addictive. Many of the people starting to use them are teenagers who never previously smoked.

Forty-seven deaths linked to vaping have been reported to the federal Centers for Disease Control and Prevention, though most of those sickened said they vaped THC, the high-inducing ingredient in marijuana. Officials believe a thickening agent used in black market THC vaping products may be a culprit.

State lawmakers in Massachusetts passed a ban last week on the sale of flavored vaping and tobacco products including menthol cigarettes. The ban now goes to the desk of Republican Gov. Charlie Baker, who appears likely to sign it.

A ban on the sale of menthol cigarettes was omitted from the New York City legislation after lobbying by advocates including the Rev. Al Sharpton, who has argued that a ban on menthol cigarettes could lead to harsh police enforcement in the black community.