CAMBRIDGE, Mass. — Massachusetts has moved a step closer to banning all flavored e-cigarettes and tobacco products, including menthol cigarettes, amid a national push to contend with the risks of vaping.

The State Senate followed the House late Wednesday in passing a sweeping ban, which, if signed into law, would make Massachusetts the first state in the nation to bar all flavored vaping and tobacco products . Other states were said to be closely watching the outcome in Massachusetts.

More than 40 people have died and more than 2,000 others have been sickened in recent months from respiratory illnesses that the authorities have connected to vaping. Most of the illnesses have been attributed to vaping THC products, but the outbreak has set off a flurry of efforts to regulate e-cigarettes.

President Trump announced in September that his administration would ban the sale of most flavored e-cigarettes, citing the illnesses and a rise in vaping among young people. But he set aside that plan, under pressure from lobbyists and political advisers, who told him the move would cost him support.