The first time Danny Peters, 55, walked around Community Correction Center II, a halfway house in Philadelphia, he felt he’d been there before.

“It was like déjà vu,” he said.

Until then, he had only seen it in a virtual reality video while serving a mandatory life sentence at Graterford prison, a state correctional facility outside Philadelphia. At the time, he had been incarcerated since 1980, when he was just 17 years old.

In 2012, the Supreme Court decided that mandatory life without parole sentences for juveniles were unconstitutional. And in 2016, the court made the decision retroactive, making nearly 2,000 juvenile lifers eligible for resentencing and for parole.

Suddenly, corrections officials in many states had to figure out what to do with inmates they never expected to have a life beyond the prison walls. In Pennsylvania, prison officials turned to virtual reality. Soon after, Colorado followed suit, creating a three-year virtual reality-based re-entry program for former juvenile lifers. Now, several other states as well as the federal Bureau of Prisons are interested in VR’s rehabilitative potential.

Research shows that virtual reality can be a useful therapeutic tool, helping people overcome post-traumatic stress, anxiety and phobias. In some cases, virtual reality programming has even been shown to promote empathy. Proponents of VR in prison hope that it can help prepare juvenile lifers for life after decades behind bars. Critics caution that VR is a crutch, and can’t replace intensive programs that address inmates’ social-emotional development.

Danny McIntyre, the director of the Bureau of Community Corrections in Pennsylvania, had seen VR headsets promoted at corrections conventions. Virtual reality equipment now costs a fraction of what it did 10 years ago, and many companies have eyed the corrections industry as a new market. When Graterford prison needed a way to help juvenile lifers transition, McIntyre started thinking: Could VR be helpful here? Pennsylvania has the largest number of juvenile lifers: more than 500 in total.

“Could VR help inmates prepare to be in a large crowd?” he wondered. “Could we prepare them to do everyday common things? Things that we take for granted. Things they haven’t done in their entire lifetime.”

Ultimately, McIntyre settled on helping inmates deal with the anxiety of freedom by creating a 360-degree video of the state’s halfway houses. It cost the DOC $3,500 to film all of the centers, and the 24 headsets it uses run less than $500 apiece.

When Peters first toured his halfway house using the headset, he found it so disorienting he couldn’t stand up. The headset covered his eyes, and his viewpoint changed as he turned his head to look around.

“It was kind of like vertigo,” he said. “Even after using [the headset] sitting down, the feeling takes about two hours to wear off. But you actually feel like you are walking through the halfway house, and they explain everything to you.”

In 2016, the Colorado legislature passed a bill to create a specialized program for juvenile lifers who were now eligible for parole. Inmates petition the DOC to participate after they have served 20 to 25 years of their sentence. Melissa Smith, programs coordinator for the prison, asked inmates what they wanted to learn.

“Right now we have 32 lessons,” she said. “From how to cook a hotdog in the microwave to how to do laundry. How to self-scan at the checkout. How to walk on a busy street. How to use an ATM card.”

Smith hired with a VR company based in New York, Nsena VR, to develop the interactive videos. The DOC received $20,000 from the state to run the program, and it cost $180,000 to buy equipment and make the video modules. The videos play in a headset, and inmates use controllers that double as virtual hands to complete tasks. The graphics aren’t photorealistic, but they are real enough to evoke strong reactions from the user.

“We had one gentleman who did the grocery store video,” Smith said. “When he took the headset off, he had tears streaming down his face, and the first thing out of his mouth was, ‘What else in the world has changed?’ ”

In addition to using virtual reality, the inmates take classes, learning new skills before trying them in VR. To manage their emotions during the virtual simulations, the inmates work with a social worker and participate in biofeedback sessions, which help them overcome uncomfortable physical reactions to stress.

“We really try to create an environment to work through skills, concepts and emotions, so they can adapt to situations they’ve never faced before,” Smith said. “We learn by trial and error, so this is about giving the inmates opportunities to be in new situations and find positive ways to interact within society.”

So far none of Colorado’s 48 juvenile lifers has been released, and Smith says it’s too soon to say how well the experimental program works. It is still in its first year, and inmates must complete all three years to be eligible for parole. Still, Colorado’s VR work has garnered interest from several other states, as well as the BOP. Smith says officials in Florida, Oklahoma and Virginia have expressed interest in using VR programming for prisoners who have spent several decades behind bars.

A BOP spokesperson says the department actively monitors new technologies such as VR, but does not currently use VR in reentry programming.

The Alaska DOC is planning on implementing VR sessions to help offenders cope with the state’s long and dark winters. The DOC has joined with a Colorado-based research organization, National Mental Health Innovation Center, to informally study the pilot program. Matt Vogl, president of the center, says he is optimistic that VR will be beneficial to inmates, citing existing research.

“We have to try new things and try them aggressively,” Vogl said. “I don’t think tech will solve all the problems, and there are a lot of unanswered questions, but if we can put one more tool in the tool box, we might as well.”

Life Inside Essays by people in prison and others who have experience with the criminal justice system

As the promise of VR spreads, critics assert that prisons are looking for a relatively inexpensive tech solution to a social problem. How well VR works to rehabilitate inmates is unknown since these programs are the first of their kind. Nancy Wolfe, a professor at Rutgers University whose research focuses on mental health issues and the justice system, says the challenges can be worse for people who enter prison as teenagers and leave as adults.

“You don’t realize how much the brain has gone dormant when you put people in an artificial environment that constrains their choices and limits their sensory information,” she said.

Inmates’ schedules are highly regulated, with correctional officers dictating what they can wear and when to eat, shower, or work. Juvenile lifers enter prison at the same time their brains are starting to develop important cognitive functions such as emotional-regulation and decision making. Adjusting to life in the outside world, with the sheer number of daily decisions they will have to make, can be difficult after decades without practice.

Peters, who was the first in Pennsylvania to experience VR and the first juvenile lifer in the state to earn his release, remembers feeling paralyzed over the thought of doing mundane tasks prior to his parole.

“I had never paid a bill in my life, so when I knew I was getting ready to leave, all the sudden I was thinking, ‘I have to pay rent. I need a phone. I have to pay my electric bill and buy gas and clothes,’ ” he said. “I felt an anxiety in my stomach that I never felt before.”

Many juvenile lifers are already at a cognitive disadvantage before entering prison. A 2012 survey of more than 1,500 juvenile lifers conducted by The Sentencing Project found that 71 percent experienced domestic and community violence, a rate six times higher than the general population. Research shows that trauma and toxic stress is damaging to the brain, hampering cognition, attention and impulse control.

“These are the kids that experienced neglect and maltreatment that led to criminal behavior at 13 years old in the first place,” Wolfe said.

However, in the right environments, the brain can be rewired. Wolfe argues inmates would be better served by having more contact with supportive role models who can help walk them through anxiety-producing tasks while mirroring positive ways to cope with the frustration of everyday life. But these kinds of programs are largely absent from prisons, and are more expensive and time consuming.

Prison officials in Colorado and Pennsylvania hope that VR can help jumpstart the process, ensuring that juvenile lifers successfully return to society. But Peters cautions that a virtual scenario is no replacement for real life.

“Nothing can prepare you,” Peters said, who now works as a general contractor in the Philadelphia area. “It is worse than a culture shock. I liken it to taking me to a foreign country, leaving me there, and having to learn everything all over again in a new language.”