Imagine being confined to a metal cell with a couple of other people and few amenities for months or even years. Maybe after that, you’ll be moved to a new compound, but you still have no privacy and extremely limited communication with your family and anyone else in the outside world. You feel both crowded and lonely at the same time, and yet no one comes to treat your emerging mental-health problems.


While this might sound like life in prison, it could just as easily be life as a deep-space explorer, in a sardine can of a rocket hurtling to Mars or a more distant world. Despite years of research by NASA and others, scientists have little insight into the psychological, neurological and sociological problems that will inevitably afflict space travelers battling depression, loneliness, anxiety, stress and personality clashes many millions of miles away from home. Sure, a growing body of research now documents the impact of microgravity on one’s brain and body, along with the exercises and medical attention needed to mitigate the effects. But social isolation, limited privacy, interpersonal issues, along with vast separation from loved ones, remain relatively unexplored.


Even massive Star Trek spaceships - with plenty of space per person - come with counselors on board, but what if the crew member with counseling training gets injured or falls ill during a critical moment? If morale plummets and rapport among the team disappears, an emergency situation could spell the end of both the astronauts and the mission.


Space confronts us with many fascinating worlds and phenomena. But we have to traverse the void to reach them, and almost any trip will be long and boring before we arrive. Peeking out the little window offers the same view you saw yesterday and the day before. While a jaunt to the Moon takes just a few days, it’s a slow, eight-month journey or longer to Mars. A trip to the more intriguing asteroids or moons of Jupiter and Saturn such as Europa and Titan would take years. (And, just for scale, an attempt to send a crew to Proxima Centauri, our nearest star, would likely take millennia.) Then, when you arrive, new challenges and more isolation await you.


Research on people in prison and solitary confinement offers lessons that deep-space astronauts could learn from. People in prison develop symptoms similar to ones reported by those stationed for long periods on the International Space Station: hallucinations, stress, depression, irritability and insomnia, all of it exacerbated when physical activity is difficult to achieve. You don’t have the freedom to go outside for a peaceful stroll to clear your mind or to visit and get cheered up by old friends. In solitary confinement, the social isolation, the loneliness and monotony affect your mental state and your brain activity after only a couple of weeks, and some people never totally recover from the ordeal.


To make matters worse, communication with Earth suffers more and more delay the further one travels from home. Deep-space astronauts would benefit from messages and video calls with loved ones - or better yet, virtual-reality interactions with them - but as they fly further away, it becomes less and less feasible to have those conversations. Even a highly trained team of professional, resilient people would struggle when there’s an increasingly tenuous connection to everyone they know on Earth.


It’s hard to imagine what these situations will be like, but NASA is trying. The agency’s psychological experiments with the Hawai’i Space Exploration Analog and Simulation (HI-SEAS) involve sequestering a six-member crew in a cramped dome for four months to a year on a remote, otherworldly spot on Mauna Loa, a rocky volcano. Over that time, participants pretend they’re living on another planet, such as Mars. There’s a 20-minute delay in written communications with mission control (which means 40 minutes between a message and its reply). The dome is equipped with extremely limited amenities (such as composting toilets and freeze-dried food). And residents can leave the habitat only for short time periods in simulation spacesuits.


As part of these experiments, participants wear devices and answer weekly questionnaires that track their heart rates, sleep quality, fatigue and changes in mood. Researchers hope to learn which individual and group qualities help to solve problems and resolve the interpersonal conflicts that inevitably arise when people are cooped up in a tiny space.


Researchers have already accumulated plenty of data, though not from the most recent mock mission. That one didn’t fare as well as hoped - it had to be aborted after only four days. After fixing an issue with the habitat’s power source, a crew member appeared to have suffered from an electric shock and needed an ambulance. After that individual was taken away, a disagreement about safety concerns resulted in another person withdrawing from the simulation, which then had to be called off.


An earlier simulation of six men squeezed into a spacecraft-like module in Moscow also produced surprising results. Those crew members developed increasing trouble sleeping and sometimes slept more than usual, becoming more lethargic and less active. One member’s sleep rhythm shifted to a 25-hour cycle (which is actually the length of a Martian day), making him out of sync with everyone else. Follow-up research showed that the two crew members experiencing the most stress and exhaustion were involved in 85 per cent of the perceived conflicts.


In a real mission to Mars, people will get hurt, and someone might even get killed. When heated arguments develop, cooler heads will have to prevail. Real space travel probably will have more boredom and more infighting than anything on Star Trek or Star Wars. (There’s a reason why science fiction relies on ludicrously fast speeds: it makes such trips short enough for a story.)


To minimize conflicts among the astronauts or the pain of someone suffering from a mental breakdown, experts will need to spot the signs of their flagging mental state beforehand. These future space explorers will probably undergo a battery of physical and psychological tests every day, week and month, and their data could be sent to scientists at home for analysis. Anything raising a flag of concern could then be addressed.


If there’s one thing the limited research shows, it’s that it’s hard to predict who will cope best and work well together as the weeks and months, maybe even years, wear on. Many factors can boost the chances of success, however, especially if crew members give each other precisely the kind of support and encouragement that people in prison are deprived of.


A well-performing team needs talented leaders and a closely knit group of people. They need to build trust between each other while they’re training, long before the rocket blasts off. Diverse, international crews could help to overcome some challenges that might come up, but that diversity also sometimes results in cultural and interpersonal problems. A larger crew would likely perform better than a smaller one, but the team’s size will always be limited by how much weight and fuel can be launched.


Once they’re in space, people need to keep busy, and they need to think they have something worthwhile to do, even if it’s actually of limited value. They also need a tiny bit of privacy and entertainment at times, which might include something they brought from home or a simulation of the family and friends they left behind. While at work, the crew members need clear goals and procedures to follow in a wide range of situations. Only people shown to be resilient under pressure for long periods and who have strong teamwork skills even in stressful, sleep-deprived conditions should be part of the crew.


But this is just a start. Two out of 135 space shuttle missions ended in disaster, both for unforeseen engineering problems, but none of them really faced the psychological tests that more perilous, more distant missions will have.


Humans love to explore. It’s in our blood. But setting foot on the Red Planet in 20 or 30 years is a more daunting task than anything else ever attempted. To make sure our quest to explore Mars and more distant worlds continues, we have to keep examining not just the engineering challenges but the challenges of our own minds.


Ramin Skibba is an astrophysicist turned science writer and freelance journalist whose work has appeared in The Atlantic, Slate, Scientific American and Nature magazine, among others. He is based in San Diego.