When Philip Duncan noticed mysterious bright flashes outside his Christchurch hotel window during the early-morning 7.1 Darfield earthquake in September 2010, he didn't know what he was seeing.
Flashes of electricity were surging out of the ground and into the sky, and from his high-rise hotel room at 4.35am, he at first thought he was watching a power station blowing up amid the quake.
"There wasn't a main centre to it ... it was just a big glowing flash," the WeatherWatch presenter said.
"It really just looked like it was lightning coming out of the ground in the same way that sheet lightning looks in the sky."
Now, scientists have been able to pinpoint the process that sparks "earthquake lights" - a rare phenomenon that could act as a warning before large quakes.
A study published in the journal Seismological Research Letters today, says the lights are most likely to occur on or near rift environments, where subvertical faults allow stress-induced electrical currents to flow rapidly to the surface.
The lights take a variety of forms, including spheres of light floating through the air, and have been observed in dozens of quakes around the world.
Seconds before the 2009 L'Aquila, Italy earthquake struck, pedestrians saw 10cm-high flames of light flickering above the stone-paved Francesco Crispi Ave in the town's historical city centre.
On November 12, 1988, a bright purple-pink globe of light moved through the sky along the St Lawrence River near the city of Quebec, 11 days before a powerful quake.
And in 1906, about 100km northwest of San Francisco, a couple saw streams of light running along the ground two nights before that region's great earthquake.
GNS Science seismologist Dr John Ristau said scientists believed for a long time that the phenomena didn't exist until an example was captured on film. "It's since been shown that they actually occur, but the mechanism of how they are produced has been unclear."
Continental rift environments now appear to be the common factor associated with the lights. In a detailed study of 65 documented cases since 1600AD, 85 per cent appeared spatially on or near rifts, and 97 per cent appeared adjacent to what are termed subvertical faults.
"The numbers are striking and unexpected," said study leader Robert Theriault, a geologist with the Ministere des Ressources Naturelles in Quebec, Canada.
Two of the 65 events were linked to subduction zones, but Mr Theriault suggested there may be an unknown subvertical fault present.
Most lights were seen before or during an earthquake but rarely after, suggesting to the authors that the processes responsible for light formation are related to a rapid build-up of stress prior to fault rupture and rapid local stress changes during the seismic waves.