If humans ever set up colonies on the moon and Mars, the settlements will face one big problem: food security. If colonies grow large enough or last long enough, it will likely be impractical to resupply the colonies with constant food shipments from Earth. A new study, however, says there may be a solution right underfoot: many crops are able to grow directly in lunar and Martian soils.

For their paper in the journal Open Agriculture, researchers from Wageningen University & Research in the Netherlands planted ten different earthly crops in three types of soil. One was typical, garden-variety potting soil, another was simulated lunar dust, and a third was simulated Martian soil.

While using the real deal would be the preferred option, no space agency has brought a sample of Martian soil back to Earth, and the 800 pounds of moon soil and rocks brought back by the Apollo missions has been contaminated by air and humidity. So researchers rely on regoliths, which are manufactured combinations of soils and minerals available on Earth, primarily collected from Hawaiian volcanoes and the Arizona desert.

For this experiment, however, the researchers tested what a second generation crop cycle grown on the Moon or Mars would be like. They used organic material from a previous growing cycle and mixed that with the nutrient poor regoliths. According to the paper, the team used chopped up rye grass to simulate this material. Each Friday of the experiment, they added a nutrient-rich solution created to mimic the addition of human manure and urine that astro-colonists would likely add to their lunar farms.

The crops planted in the soils included garden cress, rocket (aka arugula), tomato, radish, rye, quinoa, spinach, chives, peas and leeks. Of those, the only vegetable that failed to grow well in the exo-soils was spinach. The radishes, cress and rye all grew to a point where seeds could be harvested. The team was also able to harvest tomatoes and peas from the lunar and Martian soils. The chives and leeks grew steadily, but slower than normal. While the quinoa produced flowers, it did not produce seeds. Still, the team reports that they suspect this is the first time any plants have been grown large enough to produce fruit in the soil simulants.

In a follow-up, the team were able to germinate the radish, cress and rye seeds produced on the Mars and lunar soils, suggesting that the production of self-sustaining crops might be possible in space.

While the total biomass produced by plants in the Earth and Martian soils were pretty similar, those grown in the lunar soil were significantly lower, meaning lunar colonists might need to perform some extra steps on lunar dirt before growing plants.

The study is just a very preliminary test. Growth-limiting factors in lunar and Martian soil that are not accounted for in the simulants, like the presence of reactive nitrogen, would probably complicate farming in practice.

Still, lead author Wieger Wamelink believes this raises the possibility that outer space agriculture could become a thing. “We were thrilled when we saw the first tomatoes ever grown on Mars soil simulant turning red,” he says in a statement. “It meant that the next step towards a sustainable closed agricultural ecosystem had been taken.”

Growing crops in lunar and Martian soil is not the only option for getting fresh fruits and vegetables on the moon and Mars. Other possibilities include hydroponics, or growing plants directly in water, and aeroponics, or growing plants using a nutrients infused mist. Both, however, require lots of infrastructure, supplies and maintenance—all of which would take up space on cargo ships, as well as time and money. Creating sustainable agriculture, the researchers argue, would only require shipping lightweight packets of seeds to the colonies.

Wamelink and his team aren’t the only ones thinking about how to feed future space colonists. Last month, in the journal New Space, researchers from the University of Central Florida assessed what it would take to support one million colonists on Mars. They conclude that over the first 100 years of colonization, the growing settlement would still rely on massive food shipments from Earth. However, after a century, there would be enough lab-grown meat, cricket farms and tunnel-grown vegetables for the colony to be self-sustaining.

All of this, of course, is mere speculation. The last time a human being stepped foot on a celestial body besides Earth was in 1972 during the Apollo 17 mission. NASA says it plans to return to the moon in 2024 and private companies are also gearing up to help in the effort. Previous missions to the moon and near-Earth asteroids have been cancelled due to politics and lack of strong public support.