At dusk, graduate student Sara Lewis was sitting on her back porch in North Carolina with her dog. “We were supposed to be mowing our grass, but we never did, so we had long grass in our yard,” she recalls. “Suddenly this cloud of sparks rose up out of the grass and started flying around me.”

Each spark was a firefly: a beetle that glows in the dark. Hundreds of fireflies had gathered in Lewis’s back yard and were soaring around her. “It was this incredible spectacle,” says Lewis, “and I just sort of gasped.” Then she became fascinated. “I started wondering what the heck was going on here, what were these bugs doing, what were they talking about?” She has spent much of the past three decades studying fireflies.

In recent years Lewis’s work has taken on a new urgency. All around the world, the lights of fireflies are going out. The dazzling beetles are disappearing from long-established habitats. Often it is not clear why, but it seems likely that light pollution and the destruction of habitats are crucial factors. Biologists are racing to understand what is happening to fireflies so we can save them before their lights fade permanently.

Different species of firefly on display at the Forest Research Institute in Kuala Lumpur. Photograph: Bazuki Muhammad/Reuters

There have been fireflies since the dinosaur era, says evolutionary geneticist Sarah Lower, an assistant professor of biology at Bucknell University in Lewisburg, Pennsylvania. “The estimates we have currently are that fireflies are over 100m years old,” she says. Early in their history, they split into two groups, one of which spread throughout the Americas while the other colonised Europe and Asia.

Fireflies all belong to a family of beetles called Lampyridae. In Europe they are often called glow-worms, while American fireflies with flashing lights are known as lightning bugs. All these terms are misleading, says Lower. “They are not flies. They are not bugs. They are not worms. They are beetles.”

Fireflies are not the only luminous insects: three other beetle families have luminescent members, as do fungus gnats. However, fireflies are the most prominent. There are approximately 2,000 species.

However, fireflies are in trouble. In 2019, the Xerces Society for Invertebrate Conservation published a report on North American fireflies, warning that “populations appear to be in decline”. It was co-authored by Lewis, who is now professor of evolutionary and behavioural ecology at Tufts University in Medford, Massachusetts, and author of a book on fireflies, Silent Sparks: The Wondrous World of Fireflies.

The extent of the decrease is unclear because most firefly populations have not been tracked. The International Union for Conservation of Nature (IUCN), which monitors thousands of species, only created its Firefly Specialist Group in 2018. Fireflies are difficult to study: they are hard to find when not displaying.

“The best data we have is from the UK,” says Lewis. Citizen scientists have tracked the UK’s one firefly, the common glow-worm, Lampyris noctiluca, since the 1970s. For most species there are only anecdotes, but they all tell the same story, and biologists who study wild fireflies are convinced.

Some south-east Asian firefly species only live along riverbanks in threatened mangrove forests. Photograph: TorriPhoto/Getty Images

Earlier this month, Lewis and her colleagues published the first systematic review of threats to fireflies in the journal BioScience. They surveyed 49 firefly experts from around the world, asking them to rank 11 potential threats in order of importance. “These are people on the ground who have been working with fireflies and they see what’s going on,” says Lewis. According to the experts, the biggest threats to fireflies are habitat loss, pesticides and light pollution…

1. Homes destroyed

While some animals adapt to life in human environments such as cities, many fireflies need particular habitats, so are vulnerable if those habitats are destroyed.

The congregating fireflies of south-east Asia are an example. The males have flashing lights with which they attract females. They gather at night in a mangrove tree, and flash – whereupon the females fly in and choose mates. In some species the males synchronise their flashes, creating spectacular displays that tourists love.

Most such fireflies are in the genus Pteroptyx, and live only around riverbanks. After mating, the females lay their eggs in the mud of the riverbank. The larvae develop there and spend months feeding on snails, before becoming adults and returning to their display trees. “All the parts of their life-cycle depend on that habitat,” says Lewis. But humans are cutting it down and replacing it with oil palm plantations. “For that particular group of fireflies, habitat-loss is a really big thing.”

2. Too bright

A female glow-worm shining to attract her mate – her work will be made harder by brighter skies. Photograph: Jason Steel/TUFTS UNIVERSITY/AFP via Getty Images

The second biggest threat, according to the survey, is light pollution. This takes many forms, from bright and direct streetlights to the diffuse “skyglow” that means the sky is never truly dark. Most biodiversity studies have largely neglected light pollution, says Lewis. “But for fireflies it’s front and centre.”

In 2018, Lewis and Avalon Owens of the biology department at Tufts identified five ways in which nocturnal light pollution could affect fireflies, in a study published in Ecology and Evolution. The light can make them lose track of the time or their position. The fireflies may struggle to recognise important objects, such as their snail prey. In species where one sex is attracted to the glow of the other, artificial lights may disrupt mating. Finally, really bright lights may dazzle or even blind the fireflies.

Some species are more vulnerable to light pollution. In the eastern US, big dipper fireflies (Photinus pyralis) are thriving. They are not tied to a particular habitat and are common in New York City. “They’re in people’s back yards in Brooklyn,” says Lewis. “The adults fly in parking lots.” However, this reflects big dipper fireflies’ lifestyle. “Their courtship activity is actually just around sunset, so it’s already quite light,” says Lewis. “They don’t seem to be disturbed at all by the high light-levels in urban environments.”

This is unusual. Many fireflies display late at night, when it would naturally be very dark. “If there’s a lot of background illumination from streetlights or even skyglow, then their signals are going to be less visible,” says Lewis. These nocturnal species are most vulnerable to light pollution.

Fireflies’ eyes are particularly sensitive to certain kinds of artificial light, says Alan Stewart of the University of Sussex. His team studied the eyes of British common glow-worms, in which males are attracted to glowing females. The males’ eyes were tuned to the females’ green light, but when blue light was added, the males struggled to find the females. This means new LED streetlights, which are longer-lasting and thus environmentally beneficial, are likely to disrupt the fireflies more than old-fashioned sodium streetlights, due to their blueish light.

3. Chemicals and collectors

Thailand banned the pesticide chlorpyrifos, as well as herbicides glyphosate and paraquat in October 2019. Photograph: Romeo Gacad/AFP via Getty Images

The third major threat is pesticides. This never occurs to most people, says Lewis, because they see fireflies only as displaying adults. “People don’t really think about the life cycle,” she says. Most of a firefly’s life is spent as a larva, on or under the ground, or underwater. There, they are exposed to pesticides. Firefly larvae are especially at risk because they are predators, normally hunting small snails, each of which may contain a dose of pesticide. “If people were aware of that, I think they would be a lot more hesitant to spray pesticides on their lawn,” says Lewis.

In parts of Asia, fireflies are taken from the wild in huge numbers. “They have big insect festivals and will hire local people to go out, catch a bunch of fireflies and release them at the festival,” says Lower. If the fireflies are habitat specialists, they will not survive. “That’s depleting populations in some places.” One conservation organisation estimated that over 17m were purchased in China in 2016.

Beyond these external factors, there are also risks tied to fireflies’ lifestyles. In a 2019 paper published in Biodiversity and Conservation, Lewis and her colleagues highlighted “numerous risk factors”. For instance, adults often cannot fly far – and in some species may not fly at all – so they struggle to move if their habitat is threatened. Many species also have specialised diets, so can starve if their food supply is lost.

Kiichiro Minami, who helped restore Japan’s population of fireflies. Photograph: SilentSparks.com

The good news is, now we are getting a handle on what is happening to fireflies, we can do something. Some practices, such as the harvesting of fireflies, simply need to stop. Japan has achieved this. In the early 1900s, firefly shops collected the insects, packed them into bags and sent them by bicycle courier to big cities where they were released for people to enjoy. “That put a huge dent in firefly populations,” says Lewis. In the 1920s a young man named Kiichiro Minami figured out how to rear fireflies in captivity, with no scientific training. Minami started releasing the fireflies back into rivers, restoring the population. This is still happening. “Schoolchildren raise fireflies in class and release them into rivers,” says Lewis. While Japan’s fireflies have not been restored to their former glory, they are a conservation success story.

Beyond that, Lewis identifies three actions that should help every firefly species. First, she says, “if there’s a place with firefly biodiversity or abundance, try to preserve that habitat.” Not all of us can do that, but one thing anyone who lives near fireflies can do is reduce light pollution. “Turn off your lights during firefly season, or just turn off your lights in general. Have motion-detector lights that only come on when you need them.” And reduce the use of pesticides.

People can also help by reporting firefly sightings. Anyone in North America can do so by joining the organisation Firefly Watch, which has been running since 2010. There are similar “citizen science” schemes in many countries. You can also join iNaturalist, which allows you to submit photos of animals for identification.

“We just want people to go out and enjoy fireflies in their natural habitats as much as they can,” says Lewis. Stewart agrees, calling fireflies a “magical experience”.

With care, many of us may one day have fireflies sparkling in our back yards.

Lampyris Noctiluca: Britain’s only firefly

A Lampyris noctiluca female glowing at night, Cornwall. Photograph: David Chapman/Alamy

The UK has only one native firefly: the common glow-worm (Lampyris noctiluca). Lampyris is found also on mainland Europe. They are best seen in June and July evenings, when females glow green to attract males. The UK glow-worm survey website offers a wealth of information.

Common glow-worms live for two years. They hatch from eggs in late summer, grow a little by feeding on tiny snails, then hibernate through winter. They spend the next spring and summer growing, hibernate, then pupate in spring. They emerge as adults around June, mate, lay eggs and die. The long life cycle is a vulnerability, says Sussex University’s Alan Stewart: “A lot can happen in two years.”

They are partial to a mixture of woodland and grass or scrub, says conservationist John Tyler, who lives in Buckinghamshire. “The larvae feed on snails and like dense cover; the adults need open space to glow and for the males to find them.”

They are not officially endangered, because they have not been assessed by the IUCN. But there is evidence of decline. In a 2017 study in the journal Lampyrid, Tyler and his colleagues compiled data from 15 English sites and found sharp falls. “Even on nature reserves they’re declining,” he says.

Common glow-worms face many of the same threats as other fireflies, but are particularly vulnerable because adult females cannot fly. “They’re extremely bad at colonising new sites, or recolonising sites where they’ve been lost,” says Tyler.