E-cigarette maker Juul Labs Inc bought online advertisements on teen-focused websites for Nickelodeon, Cartoon Network and Seventeen magazine after it launched its product in 2015, according to a lawsuit filed on Wednesday by the Massachusetts attorney general's office.

The allegations in the lawsuit, stemming from a more than year-long investigation, contradict repeated claims by Juul executives that the company never intentionally targeted teenagers, even as its products became enormously popular among high-school and middle-school students in recent years.

The lawsuit filed by Massachusetts Attorney General Maura Healey said the company worked through online ad buyers to purchase space on websites that were "highly attractive to children, adolescents in middle school and high school, and underage college students," including educational websites such as coolmath-games.com and socialstudiesforkids.com.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The attorney general's office said those ad purchases began in June 2015, when the product launched, and continued into 2016. Juul had the ability to put certain websites onto a "blacklist" that would prohibit ads from appearing there, according to the attorney general's office, but the company chose not to do that.

A Juul spokesman said in an emailed statement on Wednesday: "While we have not yet reviewed the complaint, we remain focused on ... earning the trust of society by working cooperatively with attorneys general, regulators, public health officials ... to combat underage use."

Over the past year Juul has faced a hail of criticism and regulatory scrutiny over its role in what public health officials call an "epidemic" of teenage nicotine addiction.

The lawsuit, filed in Suffolk County Superior Court in Boston, seeks unspecified damages from Juul to compensate those affected by nicotine addiction and to pay for the costs associated with "combating this public health crisis," the Massachusetts attorney general's office said.

In addition to the online ad purchases, the lawsuit alleges that a marketing firm Juul hired ahead of its 2015 launch initially proposed an advertising campaign that would have positioned the firm as a "technology company" that had invented products that were "better than cigarettes." It contrasted the Juul vaping device with items such as boom boxes or retro mobile phones that are recognizable to adults, with the tagline "everything changes, eventually."

Juul rejected that campaign, according to the lawsuit, and instead chose a strategy meant to "win with the cool crowd in critical markets," choosing to promote "fashionable young people, frequently in a sexually provocative context." Images from that marketing campaign in 2015 were used in the banner and video advertisements used on the teen-focused websites, according to the lawsuit.

Juul has previously said the early marketing campaign targeted young adults in their 20s and early 30s, not teenagers, but that it regretted the style of the advertising in hindsight.

The company in recent months has tried to revamp its image, as it faces a critical May regulatory deadline with the U.S. Food and Drug Administration. In September it brought on a new chief executive officer, K.C. Crosthwaite, a veteran of Marlboro maker Altria Group Inc, who has restructured the company around gaining approval to sell its products in the United States.

Follow NBC HEALTH on Twitter & Facebook.