Lego, the world’s largest toymaker, has pledged to eliminate gender stereotypes from its products — including labeling that marks toys as “for girls” or “for boys” — as part of a bid to match the wishes of its young customers.

“Despite the progress made in girls brushing off prejudice at an early age, general attitudes surrounding play and creative careers remain unequal and restrictive,” the Danish company known for its colorful building blocks said in a statement on Monday, which was also the United Nations Day of the Girl. “Girls today feel increasingly confident to engage in all types of play and creative activities, but remain held back by society’s ingrained gender stereotypes as they grow older.”

Lego’s move comes amid heightened debate about the role that toys play in creating and perpetuating gender stereotypes. On Saturday, California Gov. Gavin Newsom (D) signed a new law requiring large retail stores in the nation’s most populous state to provide gender-neutral shopping sections for child-care items and toys beginning in 2024.

The toymaker’s announcement also comes in response to a global survey, commissioned by Lego and conducted by the Geena Davis Institute on Gender in Media, that found that parents and, to a lesser extent, their children, are still influenced by gendered notions of career. Young girls are also more willing to participate in activities that cut across “gender norms” than their male peers, the poll found.

For instance, when asked which gender immediately comes to mind upon thinking of scientists, parents from seven countries were much more likely to say “male,” researchers found, using online, opt-in surveys.

And while 82 percent of girls saw nothing wrong with them playing soccer and boys doing ballet, only 71 percent of their male counterparts felt the same way.

While it was heartening to see girls becoming more confident, Madeline Di Nonno, the institute’s chief executive, said the discrepancy might also reflect that boys fear being teased or bullied if they play with toys associated with girls.

“Let the kids decide what they want to play, how they want to play with it and how they want to express themselves,” she said in an interview.

“Our job now is to encourage boys and girls who want to play with sets that may have traditionally been seen as ‘not for them,’ ” Julia Goldin, Lego’s chief product and marketing officer, told the Guardian newspaper.

The company said in an emailed statement that it would work to offer a more diverse array of characters and roles so that no child would “feel that they weren’t welcome or represented” in Lego products.

The Equality Act is a positive step forward for the LGBTQ community. But it came with swift backlash from conservative lawmakers. (Monica Rodman, Sarah Hashemi/The Washington Post)

The campaign to make toys and other children’s products more gender-neutral has been around for several years. Advocates including Evan Low, a Democratic assemblyman who helped write the new California law, note that gender-based divisions of such products have contributed to “the proliferation of [science, technology, engineering and mathematics]-geared toys” for boys and “pursuits such as caring for a baby, fashion, and domestic life” for girls.

Some conservative organizations, however, pushed back on the California bill, arguing that a government-imposed view on gender constitutes a violation of free speech and reflects attempts to impose a gender-neutral ideology.

In any case, Lego is pushing ahead with gender-agnosticism when it comes to marketing its products: Its website no longer categorizes brick sets based on gender.