A flash of luck helped astronomers solve a cosmic mystery: What causes powerful but fleeting radio bursts that zip and zigzag through the universe?

Scientists have known about these energetic pulses -- called fast radio bursts -- for about 13 years and have seen them coming from outside our galaxy, which makes it harder to trace them back to what's causing them. Making it even harder is that they happen so fast, in a couple of milliseconds.

Then this April, a rare but considerably weaker burst coming from inside our own Milky Way galaxy was spotted by two dissimilar telescopes: one a California doctoral student's set of handmade antenna s, which included actual cake pans, the other a $20 million Canadian observatory.

They tracked that fast radio burst to a weird type of star called a magnetar that's 32,000 light-years from Earth, according to four studies in Wednesday's journal Nature.

It was not only the first fast radio burst traced to a source, but the first emanating from our galaxy. Astronomers say there could be other sources for these bursts, but they are now sure about one guilty party: magnetars.

Magnetars are incredibly dense neutron stars, with 1.5 times the mass of our sun squeezed into a space the size of Manhattan. They have enormous magnetic fields that buzz and crackle with energy, and sometimes flares of X-rays and radio waves burst from them, according to McGill University astrophysicist Ziggy Pleunis, a co-author of the Canadian study.

The magnetic field around these magnetars "is so strong any atoms nearby are torn apart and bizarre aspects of fundamental physics can be seen," said astronomer Casey Law of the California Institute of Technology, who wasn't part of the research.

There are maybe a dozen or so of these magnetars in our galaxy, apparently because they are so young and part of the star birth process, and the Milky Way is not as flush with star births as other galaxies, said Cornell University Shami Chatterjee, who wasn't part of either discovery team.

This burst in less than a second contained about the same amount of energy that our sun produces in a month, and still that's far weaker than the radio bursts detected coming from outside our galaxy, said Caltech radio astronomer Christopher Bochenek. He helped spot the burst with handmade antennas.

These radio bursts aren't dangerous to us, not even the more powerful ones from outside our galaxy, astronomers said.

The ones that come from outside our galaxy and travel millions or billions of light-years are "tens of thousands to millions of times more powerful than anything we have detected in our galaxy," said co-author Daniele Michilli, an astrophysicist at McGill and part of the Canadian team.

Scientists think these are so frequent that they may happen more than 1,000 times a day outside our galaxy. But finding them isn't easy.

"You had to be looking at the right place at the right millisecond," Cornell's Chatterjee said. "Unless you were very, very lucky, you're not going to see one of these."

Even though this is a frequent occurrence outside the Milky Way, astronomers have no idea how often these bursts happen inside our galaxy.

"We still don't know how lucky we got," Bochenek said. "This could be a once-in-five-year thing or there could be a few events to happen each year."

Bochenek's antennas cost about $15,000. Each is "the size of a large bucket. It's a piece of 6-inch metal pipe with two literal cake pans around it," the doctoral student said. They are crude instruments designed to look at a giant chunk of the sky -- about a quarter of it -- and see only the brightest of radio flashes.

Bochenek figured he had maybe a 1-in-10 chance of spotting a fast radio burst in a few years. But after one year, he hit pay dirt.

The Canadian observatory in British Columbia is more focused and refined but is aimed at a much smaller chunk of the sky, and it was able to pinpoint the source to the magnetar in the constellation Vulpecula.

Because the bursts are affected by all the material they pass through in space, astronomers might be able to use them to better understand and map the invisible-to-us material between galaxies and "weigh" the universe, said Jason Hessels, chief astronomer for the Netherlands Institute for Radio Astronomy, who wasn't part of the research.

Astronomers have had as many 50 different theories for what causes these fast radio bursts, including aliens, and they emphasize that magnetars may not be the only answer, especially since there seem to be two types of fast radio bursts. Some, like the one spotted in April, happen only once, while others repeat themselves often.

Michilli said his team has traced one outburst that happens every 16 days to a nearby galaxy and is getting close to pinpointing the source.

Some of these young magnetars are only a few decades old, "and that's what gives them enough energy to produce repeating fast radio bursts," Cornell's Chatterjee said.

Tracking even one outburst is a welcome surprise and an important finding, he said.

"No one really believed that we'd get so lucky," Chatterjee said. "To find one in our own galaxy, it just puts the cherry on top."

------

Follow Seth Borenstein on Twitter at Γåòborenbears.

------

The Associated Press Health and Science Department receives support from the Howard Hughes Medical Institute's Department of Science Education. The AP is solely responsible for all content