Illustration of NASA's Curiosity rover which has been exploring Mars since 2012. NASA/JPL-Caltech/MSSS

Rock and soil samples from Mars are teaching scientists more about the history of water on that planet, including how hospitable its water would have been for alien life around the same time that life was evolving on Earth, about 3.5 billion years ago.

The NASA rover Curiosity picked up samples from the lower layers of Mount Sharp, which are composed of sediment that accumulated while the spot was still underwater. Analysis showed “variations in minerals that suggest changes in the area have occurred,” NASA said. The differences in the mineral compositions of the samples paint a picture of a diverse environment that evolved over time.

Read: Titan’s Rivers Flow Like They Did On Mars, Not Earth

The layers of Mount Sharp represent different time periods built up by sediment, with the lowest being the earliest. At that lowest level, NASA said, the rock minerals include a lot of iron and magnesium, a sign of “a primitive magma source,” like what you would find in volcanic rock in Hawaii. Moving up the Mount Sharp ladder, the types of minerals locked inside the sediment changed, cycling through clay minerals that form when water has roughly a neutral pH — indicating it is neither acidic nor alkaline — as well as a type of mineral called jarosite that forms in more acidic liquid.

This data gives scientists a lot to work with when it comes to seeing how hospitable Mars would have been to alien life. According to NASA, the water with the almost neutral pH would have been pretty comfortable for that.

A study on the sediment samples in the journal Earth and Planetary Science Letters says the local environment probably started with that neutral ancient lake before acidic groundwater came in and contributed to the newer mineral makeups.

The changes the local water went through would have been substantial “but both offered liquid water and a chemical diversity that could have been exploited by microbial life,” NASA explained.

Indeed, water being more acidic does not rule out hosting living things. Recent research has suggested that life on Earth formed in more acidic oceans that gradually became more neutral over time, a slow change that allowed the creatures to adapt to the evolving conditions.

Read: Curiosity Studies Sand Dunes on Mars

The sediment findings add to information scientists already had about the changing Mars environment. Compared to its dry and cold landscape today, research indicates it was once much warmer and wetter, even having enough rainfall to carve river channels into its surface. It may also have had enough water cycling through its surface and atmosphere to support a large ancient ocean. Much like on Earth, the water cycle on Mars would have included water evaporating from the ocean and then raining back down, with engorged rivers flowing back into the larger body of water.

But the planet has changed over the years, losing that water as well as about two-thirds of its atmosphere to space. The rocks that Curiosity picked up and analyzed may show the environmental changes that took place as that happened.

“We have all this evidence that Mars was once really wet but now is dry and cold,” NASA scientist and lead author Elizabeth Rampe said in the space agency’s statement. “We think early Mars may have been similar to early Earth, and so these environments might have been habitable.”