NEW YORK — Walmart said Friday that it would stop selling electronic cigarettes at its namesake stores and Sam’s Clubs following a string of mysterious illnesses and deaths related to vaping.

The nation’s largest retailer, based in Bentonville, Ark., said it would exit e-cigarette sales after selling its current inventory.

The move is due to "growing federal, state and local regulatory complexity" regarding vaping products, the company said in a statement.

President Donald Trump has proposed a federal ban on flavored e-cigarettes and vaping products. Michigan banned the sale of flavored e-cigarettes this week. A few local governments, including San Francisco, have passed bans on flavored tobacco.

E-cigarettes represent a very small part of Walmart’s nicotine business, which also includes traditional cigarettes, smokeless tobacco, and nicotine gum. But the vaping industry has come under increased scrutiny after the deaths and illnesses — along with a surge in underage e-cigarette use.

More than 500 people have been diagnosed with breathing illnesses after using e-cigarettes and other vaping devices, according to U.S. health officials. An eighth death was reported this week. Health officials still have not identified the cause.

In July, Walmart raised the minimum age to purchase tobacco products and e-cigarettes, to 21. It also said then that it was in the process of discontinuing the sale of fruit- and dessert-flavored electronic nicotine delivery systems.

The Vapor Technology Association, a trade group, was quick to slam Walmart’s move against vaping products while keeping cigarettes on its shelves.

“The fact that Walmart is reducing access for adult smokers to regulated vapor products while continuing to sell combustible cigarettes is irresponsible,” Tony Abboud, executive director of the association, said in a statement. “This will drive former adult smokers to purchase more cigarettes.”

More than 500 people have been diagnosed with breathing illnesses after using e-cigarettes and other vaping devices, according to U.S. health officials.