Volcanic lightning is one of nature’s most epic displays, but what exactly causes the phenomenon is a longstanding mystery. Now, by studying high-speed footage of electrified volcanic outbursts at Mount Sakurajima, scientists have arrived at an answer—and it points to a new method for predicting powerful eruptions.

Most of us are familiar with how lightning forms in thunderclouds, when negatively charged particles at the bottom of the cloud are drawn to positively charged particles on the surface of the Earth. Eventually, this electrostatic attraction can overcome the insulating properties of the air, producing a giant electric spark.

While similar in terms of its physical characteristics, volcanic lightning is different in the sense that it forms much closer to the ground within erupting volcanic plumes, and doesn’t necessarily propagate downwards. A team of researchers at Ludwig-Maximillian University in Munich have conducted a detailed study of volcanic eruptions at Japan’s Mount Sakurajima, one of the most active volcanoes on Earth, to figure out why.

Combining high-speed video footage of eruptions and acoustic measurements of Mount Sakurajima’s electromagnetic field, the researchers determined that volcanic lightning occurs due to the electrification of rising ash particles by magma. They further showed that volcanic lightning (top video) is generally restricted to the lower part of a developing ash plume—within a few hundred meters of the crater’s rim—where turbulent jets of magma produce a complex charge distribution. Only in one instance (bottom video) was lighting observed in the upper “buoyant” part of the plume.

“At Sakurajima as well as at other volcanoes the electrification seems to be primarily determined by the plume dynamics,” the researchers write in their paper, which appears this week in Geophysical Research Letters.

The study also revealed an unexpected correlation between the frequency of lightning flashes and the total volume of ash released. The amount of ash a volcano will spew out is hard to predict during an eruption, but not so for electrical discharges. “This is a parameter that can be measured—from a distance of several kilometers away and under conditions of poor visibility,” lead study author Corrado Cimarelli said in a statement.

This means that, eventually, scientists could start using volcanic lightning to predict the size of an ash cloud and issue early warnings about air quality following eruptions. Even if you don’t live in a volcanically active area, there’s cause to be excited about this: it means plenty more stunning photos of volcanic lightning to come.

[Geophysical Research Letters]