Scientists may have cracked a 40-year-old mystery about how early Earth grew warm enough for water to pool on its surface — a condition believed to be necessary for life – despite meager warming from a young sun.

The key, says a team of NASA astronomers, is a phenomena known as superflares, which are massive and frequent solar flares that blasted high-energy particles toward baby Earth and its sibling planets.

Computer models show that near-daily deluges of energetic particles streaming from the sun would have compressed Earth’s magnetic bubble and caused gaps to open over the polar regions.

Photos: Top 10 Places To Find Alien Life

The particles could then penetrate into the atmosphere, setting off a cascade of chemical reactions that created the extremely potent greenhouse gas nitrous oxide, as well as hydrogen cyanide, an essential compound for life, a study published in this week’s Nature Geoscience shows.

Earth would have grown warm enough for liquid water as far back as 4 billion years ago, the study shows.

The first signs of microbial life appear as fossilized rock dating back to about the same time.

Photos: The Psychedelic Anatomy of a Solar Flare

Scientists have tried for decades to solve the so-called “faint young sun” paradox, an issue raised by astronomers Carl Sagan and George Mullen  in 1972.

“It’s perplexing because it is unclear why Earth was not permanently glaciated under the less luminous sun,” Cornell University’s Ramses Ramirez writes in a related commentary in Nature Geoscience.

The new theory extrapolates data collected by the Kepler space telescope, whose primary mission was to look for planets orbiting sun-like stars.

Temporary dips in the amount of light coming from target stars could be caused by planets flying across the face of their parent stars, relative to Kepler’s line of sight. But the changes also could be caused by other events, including, it turns out, superflares.

Black Holes Set the Clock for Life on Earth

“Kepler observed the superflares of young stars, resembling our sun at the time when life started on Earth … We used these as proxies,” astrophysicist Vladimir Airapetian, with NASA’s Goddard Space Flight Center in Greenbelt, Maryland, told Discovery News.

The superflares turn out to be three times more powerful than the biggest flare in recent history, the so-called Carrington event in 1859, which caused Northern Lights auroras as far south as Miami.

“A very, very conservative number is that one of these events occurred every single day, and each event lasts for two or three days, so that suggests the Earth was under constant attack from these powerful coronal mass ejections,” Airapetian said.

Coronal mass ejections, or CMS, release massive amounts of solar particles and electromagnetic radiation into space.

Ramirez, for one, already is putting Airapetian’s theory to test by using the atmospheric chemistry data in another computer model.

How Early Earth Got Its Nitrogen

“My goal is to compute the resultant greenhouse warming from the predicted gas concentrations and determine if they are enough to solve the faint young sun problem,” Ramirez told Discovery News.

The study not only has implications for how Earth evolved for life, but also how neighbor planet Mars managed to support liquid surface water.

“Our concept implies that the activity of the early sun provided a window of opportunity for prebiotic life on Earth. The proposed model also redefines the conditions of habitability, not just in terms of a ‘liquid water zone,’ but as a biogenic zone, within which the stellar energy fluxes are high enough to ignite reactive chemistry that produces complex molecules crucial for life,” Airapetian writes.