It is the colossal ambition of scientists around the world to have human colonies established on Mars and the Moon by the 2030s. However, various elements of danger pose a massive challenge to creating habitats humans could actually survive in: It’s tricky to live on a different planet if you’re going to be pelted with space debris while becoming ill from space radiation.

Last week in Riga, Latvia researchers at the European Planetary Science Congress, an annual meeting of that serves as a “dissemination platform” for new space studies, presented a possible solution to the space habitat problem: Humans on Mars and the Moon could build their settlements within the planet’s massive lava tubes.

In a talk about their new, unpublished abstract geoscientists from the University of Padova and the University of Bologna explained that they conducted the first systematic comparison of lava tubes on Earth, Mars, and the Moon by creating high-resolution Digital Terrain Models based on data taken from orbiting spacecrafts, like the Mars Reconnaissance Orbiter and LIDAR. The scientists say their analysis revealed that there are promising lava tube candidates on the Mars regions of Hadriaca Patera, Arsia, and Olympus Mons and in the Marius Hill region of the Moon.

Study co-author Riccardo Pozzobon, Ph.D., announced in a press release that not only do lava tubes have the potential to house humans in space, it is also possible that these will be the sites where humans will encounter extraterrestrials. The reason is the same as why humans could live there: Lava tubes are a shelter from the harsh realities of space.

ESA astronauts have already begun to be trained to adapt living in lava tubes on Earth. ESA/L. Ricci

“These results have important implications for habitability and human exploration of the Moon but also for the search for extraterrestrial life on Mars,” says Pozzobon. “Lava tubes are environments shielded from cosmic radiation and protected from micrometeorites flux, potentially providing safe habitats for future human missions. They are also, potentially, large enough for quite significant human settlements — you could fit most of the historic city center of Riga into a lunar lava tube.”

Why a lunar lava tube could fit a city compared to a lava tube on Earth comes down to how gravity affects the creation of the tube. Pozzobon and his team say that while on Earth a lava tube can be up to 98 feet in width, on Mars there is evidence that the tubes are 820 feet in width. Meanwhile, on the Moon, the scientists believe there lava tube tunnels that could be as long as 62 miles in length and about one mile in width. In a different 2015 paper presented at the Lunar and Planetary Science Conference, scientists from Purdue University explained that because gravity is lower on different planets, rock does not withstand the same weathering and erosion as it does on Earth — which is why Moon tubes could be big enough to “easily house a city.”

Purdue scientists say that Philadelphia could fit in a Moon lava tube. Purdue University/David Blair

Lava tubes form when the edges of lava from a volcanic eruption cools and forms a ridge around the flow of lava. When the lava stops flowing the ridge cools, forms a crust, and when drained becomes a tunnel. These tubes become even larger when lava flows into layers of rock and cavities that have been altered by previous eruptions, and networks of connected tunnels can emerge. On Earth, expansive lava tubes have been found in places like Hawaii, Iceland, Australia, Sicily, and the Galapagos Islands.

As of now, scientists rely on orbiters that map the gravity of different planets to say whether or not a lava tube is present because these maps reveal the depressions and holes that indicate there’s a tunnel. This process may become easier, however, with the development of radar sounding systems. In a separate presentation at the European Planetary Science Congress, researchers from the University of Trento hypothesized that radar probes that send out low-frequency electromagnetic waves could be used to determine the physical composition, size, and shape of lava tubes.

“A mission carrying this instrument would enable a crucial step towards finding safe habitats on the Moon for human colonization,” said study co-author Leonardo Carrer, in a statement.

Lava tube-space cities sound pretty cool. Now scientists have to figure out how to transport and feed the humans that will live there.

If you liked this article, check out this video on how life could survive on Mars.