Lightning in volcanic eruptions has been somewhat of a mystery until now. It’s not that scientists don’t know how lightning forms — charge separation! — but they didn’t understand how it happens in volcanoes to produce such stunning eruptions of lava, ash and electricity.

It didn’t help that volcanic lightning is difficult to study. You have to be there to observe the eruptions, which don’t typically run on a regular schedule. Also, lightning usually only happens in the most intense eruptions, and it is often confined to the very beginning.

But two studies published recently in the Earth science journal Geophysical Research Letters help to illuminate the lightning mystery.

Lightning in volcanic eruptions is caused by the same reason it occurs in thunderstorms — negative and positive charges separate in the atmosphere, and the strike of lightning restores the charges to balance. In thunderstorms, ice crystals are the particles that electrified. But why the charge separation occurs in volcanic eruptions has been, up until now, not well-understood.

There were a few theories, one of which suggested that the ash ejected from the volcano already carries a certain charge, which then interacts with and separates from the charges in the atmosphere. That’s not what these studies found. It turns out volcanic lightning seems to be generated by at least two different physical processes.

One study — led by Alexa Van Eaton, a volcanologist at the U.S. Geological Survey Cascades Volcano Observatory in Vancouver, Wash. — analyzed lightning strokes during the April 2015 eruption of the Calbuco volcano in Chile. The World Wide Lightning Location network, composed of over 50 lightning sensors around the globe, detected thousands of lightning strikes during the massive eruption that attracted worldwide attention.

Van Eaton and her team compared the lightning strikes with the movements of the ash cloud as it was blown downwind. They found that as the very high cloud wafted away, so did the lightning. This strongly suggests that in the case of very large and intense eruptions, ice crystals are at play in the formation of lightning, just as they are in thunderstorms.

How did they know that it wasn’t the ash particles that were creating the charge? “The lightning basically decoupled from all the other ash particles that were falling to the ground,” Van Eaten told the American Geophysical Union. “Instead, they seem to follow the ice crystals that stayed high in the atmosphere.”

Van Eaten’s team also found the presence of lightning very low to the ground, as ash and gas flowed away from the caldera. This suggests that ice isn’t always the cause of volcanic lightning and that ash can create a similar charge.

In another study, scientists recorded video of volcanic lightning in eruptions of Sakurajima, a highly active volcano on the island of Kyushu in Japan, and analysed the video against infrasound and electromagnetic field measurements. They found that during an explosion, particles of ash and debris rub up against each other, which creates a build-up of electrical charge.

Corrado Cimarelli, a volcanologist at Ludwig Maximilian University in Munich and lead author of the study, concluded that electrical charges are fundamental to eruptions. “Where there is ash violently ejected in the atmosphere, there will be electrical discharges, independent of the magnitude of the eruption,” he told the American Geophysical Union.

More volcanoes:

Mount Etna’s stunningly violent eruption was among the strongest in decades

Striking imagery of the powerful Villarrica eruption in Chile

The epic volcano eruption that led to the ‘Year Without a Summer’

Scientists capture stunning, close-up lava footage from Iceland