Light and dark markings swirl over the moon, looking like cream swirled into coffee or clouds against a slate gray sky. These lunar swirls may result from ancient, magnetic lava just below the moon's surface, according to one new study.

A joint study between researchers at Rutgers University and the University of California, Berkeley, pointed to the moon's internally generated magnetic field and past volcanic activity to explain the lunar swirls.

An image of the Reiner Gamma lunar swirl from NASA's Lunar Reconnaissance Orbiter. NASA LRO WAC science team

Researchers have known for some time that lunar swirls share space with localized magnetic fields and that when those fields deflect particles from solar wind, parts of the moon's surface weather more slowly than other parts. "But the cause of those magnetic fields, and thus of the swirls themselves, had long been a mystery," Sonia Tikoo, co-author of the study and a researcher at Rutgers University-New Brunswick's Department of Earth and Planetary Sciences, said in a statement. "To solve it, we had to find out what kind of geological feature could produce these magnetic fields — and why their magnetism is so powerful."

[How the Moon Evolved: A Photo Timeline]

The researchers developed mathematical models for these localized fields, or "geological magnets" as they're described in the statement. These models showed that each lunar swirl must exist above a narrow, magnetic object located just below the lunar surface.

Even stranger, researchers think that these subsurface magnetic objects are ancient, long, narrow lava tubes formed by flowing lava or lava dikes, which are vertical sheets of magma in the crust of a moon or planet. Past experiments have shown that, when heated above 1,112 degrees Fahrenheit (600 degrees Celsius) in a zero-oxygen environment, certain minerals in moon rocks break down and release metallic iron, making the rocks extremely magnetic.

So, when the moon was erupting lava over 3 billion years ago, these magnetic lava tubes or lava dikes were likely created and became highly magnetic as they cooled down, according to the statement.

"No one had thought about this reaction in terms of explaining these unusually strong magnetic features on the moon," Tikoo said in the statement, referring to the lava becoming magnetic moon rock under the surface and causing lunar swirls. "This was the final piece in the puzzle of understanding the magnetism that underlies these lunar swirls."

This study was published July 26 in the Journal of Geophysical Research: Planets.

Email Chelsea Gohd at cgohd@space.com or follow her @chelsea_gohd. Follow us @Spacedotcom, Facebook and Google+. Original article on Space.com.

FOLLOW NBC NEWS MACH ON TWITTER, FACEBOOK, AND INSTAGRAM.