(CNN) Around the world, fireflies light up the night with their shimmering bodies. But scientists say this magical display is under threat -- with the loss of their natural habitats, pesticide use and artificial light putting some of the 2,000 or so species at risk of extinction.

Habitat loss is leading to the decline of many wildlife species, with some fireflies suffering because they need certain environmental conditions to complete their life cycle, said Sara Lewis, a professor of biology at Tufts University, who led the research published Monday in the journal Bioscience.

For example, she said, one Malaysian firefly (Pteroptyx tener), famous for its synchronized flashing displays, needs mangroves and the plants they contain to breed but across Malaysia mangrove swamps have been converted into palm oil plantations and aquaculture farms.

More surprisingly, the researchers found that the use of artificial light at night, something that has grown exponentially over the past century, was the second most serious threat to the creatures.

A female glow-worm, from the same family as fireflies, will shine for hours to attract her mate but artificial light can disrupt the process.

Skyglow

Read More