fireflies-0707 (Karolis Strautniekas for The Washington Post)

When the sun falls below the horizon, a skinny beetle named Photinus pyralis wakes up and takes to the air. We know it as the firefly, or lightning bug, an insect that transforms the sultry summer evening into a veil laced with sequins.

For the fireflies, the blips of light function primarily as a mating gambit but also as a reminder to predators that they are toxic. We think the show is for our benefit, especially if dozens of fireflies dance in near-unison together. This point of view is forgiven. Fireflies are the stuff of childhood, conjuring a time and place that may have gone but a sense of wonder that has not.

There are places where the congregation of fireflies is so great that their annual appearance isn't so much a moment as a destination. In the Great Smoky Mountains of Tennessee, nearly 30,000 people gather over a two-week period to admire "The Light Show," featuring a species of firefly whose males flash together. The spectacle, managed by the National Park Service, is so popular the tickets are distributed by lottery. It is described by biologist Sara Lewis: "Suddenly, the forest came alive with flying sparks, and thousands of male fireflies were flashing together in lockstep synchrony." At the end of each six-flash sequence, she writes in her new book, "Silent Sparks," "darkness rushed in like a shade drawn over my eyes."

The enchanting, worldwide spectacle of fireflies

In the Mid-Atlantic, you're more likely to see P. pyralis, the big dipper firefly, named for its undulating flight pattern. There are more than a dozen firefly species in our region, with their numbers peaking around Independence Day, especially in prime firefly habitat: a field or a meadow adjacent to woodland. In Arlington, where a firefly festival is held in June, that would be at Fort C.F. Smith Park close to the Potomac River, or other public parks with such features.

Alonso Abugattas, natural resources manager for the Arlington Department of Parks and Recreation, says the C&O Canal path in Maryland offers rich sightings, but really your own garden can be a firefly stage, especially if it has that “edge habitat” where the creatures can find some shade in the woods. This isn’t just important for adults, which only live a couple of weeks, but also the ground-dwelling larvae, which stick around for as long as two years before going out in a blaze of glory.

There is still much to learn about fireflies, which are found around the world and are particularly resonant in the cultural mythology of East Asian societies.

Lewis reminds us that one of the pioneers of firefly science was John Buck, who was first captivated by them in his Baltimore back yard. As head of the Laboratory of Physical Biology at the National Institutes of Health in Bethesda, he spent much of his career unlocking the secrets of the mechanics of firefly flashing. Lewis, a professor at Tufts University, has also added to our understanding, discovering that the beetle uses one gas, nitric oxide, to control another, oxygen, to switch the beacons on and off.

There is a common belief that fireflies are not as numerous today as adults remember them in childhood. Lewis said this might be more perception than reality because, let’s face it, people today tend to retreat to the air-conditioned cocoon of their homes in the evening.

But she has heard enough to believe fireflies are in trouble. “Even as a skeptical scientist and the absence of hard numbers, there’s the sheer weight and geographic scope of anecdotal data to convince me that fireflies’ numbers are declining,” she told me.

Perhaps the biggest single cause is the loss of habitat. In Florida, that might be a wetland converted into a housing development. Along the Selangor River in Malaysia, it’s the replacement of native mangrove swamps with oil palm plantations or shrimp farms.

“Once their habitat is destroyed,” Lewis writes, “the fireflies are gone too. If a breeding population is disturbed, the fireflies are unlikely to relocate somewhere else.”

This is tied to the fact that they spend most of their lives as ground-dwelling larvae. But there are measures we can take to help. For larvae, allow undisturbed areas of leaf litter and wood debris in corners of the yard, and for the adults , don’t mow the lawn too often or too short in early summer. Most of all, think hard before using any pesticides.

Insecticides designed to kill grubs will kill firefly larvae, and broad-spectrum sprays are bound to harm adult fireflies that rest on vegetation. This includes pesticide sprays used to kill mosquitoes, which experts tell me are better dealt with by removing standing water to break the life cycle.

Fighting the Asian tiger mosquito

“There are obviously public health concerns that trump the lives of fireflies,” Lewis said, “but I do believe that widespread use of pesticides for mosquito purposes has the potential to harm firefly populations.”

Another way to help fireflies is to reduce light pollution: Turn off those outside lights, if only for a week or two.

With fewer artificial lights, fireflies “are more likely to find each other to make more fireflies,” said Rachael Tolman, a naturalist at the Long Branch Nature Center in South Arlington.

The lights may not bother the dusk-loving big dipper so much, but they do interfere with other species that mate at night and need the darkness to communicate successfully. “They’ll even avoid flying when there’s a full moon,” Lewis said.

It’s fun to capture fireflies and keep them in jars as bedtime lanterns, but by morning they’ll probably be dead: They dry out. You could put a moist paper towel in with them, but it’s better to leave them be.

In other words, the firefly’s fortunes rest with us, to a great degree. As with bees, birds, butterflies, ladybirds and frogs, the gardener has the ability to make a difference, to create a little refuge and to feel good about that.

“If you have got a lot of fireflies, you can assume the habitat is fairly healthy, because all the elements that are there to support the firefly support a lot of other wildlife,” Abugattas said. No wonder we find this little insect so illuminating, so magical.

@adrian_higgins on Twitter

More from The Washington Post:

A common pesticide may be a menace to pollinators. Know how to protect them.

These creatures use glowing vomit to attract mates — and it’s utterly beautiful

Bee enthusiasts of all stripes flock to Washington amid pollinator concerns

How we control a pest in our garden without the use of pesticides

Nature got the dragonfly’s primitive design right — and even astronomers are taking note