Douglas Pyle lives in a tiny room. He has a bed barely large enough for his broad frame, and a desk where his television sits next to a potted plant and a pile of face masks. He can walk the width of the room with just two paces.

It's not much, but it's far more than what Pyle had a year ago, when he drifted the streets looking for a quick high, spending every dollar he earned as a cook at a downtown Minneapolis restaurant to buy opioid pills to ease his anxiety and depression.

Most nights, he would stumble into an emergency shelter and collapse on a bunk surrounded by up to 60 other men. When the shelters were full, he would slump across a bus bench or the seats of a light-rail car, using his backpack as a pillow.

"It was no way to live," said Pyle, 50, as he cooked dinner in his new apartment. "If I didn't die from an overdose, then COVID would certainly have gotten me."

Early in the pandemic, public health officials were terrified that the corona­virus would rip through Minnesota's homeless population — the approximately 8,000 people who sleep in emergency shelters or outside on the streets. The cramped living conditions of many shelters, where people sleep close enough to hold hands, made them particularly vulnerable to the airborne pathogen.

Yet a massive and highly coordinated campaign to move hundreds of people like Pyle out of shelters and encampments and into hotel rooms is widely credited with slowing virus transmission and preventing the worst fears from coming true. A project once considered unthinkable on a large scale successfully thinned crowded shelters across the state while providing stability for hundreds of people experiencing homelessness to find homes of their own.

"It was like preparing for a tsunami that never came," said Monica Nilsson, who helped coordinate the hotels and is executive director of Haven Housing.

New state data show that more than 400 homeless Minnesotans found permanent housing after being moved to hotel rooms, where county agencies and nonprofits sent in teams of social workers to connect them with landlords and housing assistance programs. In Hennepin County, which has the state's largest homeless population, more than 1,100 people have transitioned through hotel rooms and nearly 200 have moved into apartments since last spring.

A potential health crisis that many saw as inevitable nearly a year ago has been averted. Apart from a November spike in coronavirus cases, the infection rate among Minnesota's homeless population has stayed consistently below the rate for the state as a whole. Since the pandemic began, fewer than 800 people who are living in shelters or outside have tested positive for COVID-19, and nine homeless people have died — far short of the toll many had feared.

"I believe that we saved lives," said Cathy ten Broeke, executive director of the Minnesota Interagency Council on Homelessness, a cabinet-level body. "There was a strong commitment from the beginning to the idea that the hotel environment would be a springboard to something better."

Pyle, who is soft-spoken and careful in his movements, describes himself as a "popular loner." He will walk the streets for hours or ride the light-rail to the Mall of America simply to observe other people.

But there are mornings when his anxiety and depression are so debilitating that he cannot get out of bed. On those days, his mind drifts back to his troubled childhood in a small town in rural Indiana, where he grew up as an adopted Black child in a white family. He was the only Black student in his middle school in Spencer, Ind., where racial slurs were as frequent as the bells that rang between classes.

In one of his early memories, Pyle is riding his bike through the neighborhood when an older boy pulls him aside to ask if Pyle has heard of the Ku Klux Klan. When Pyle says he hasn't, the boy tells him to "watch himself" because the Klan wears robes and carries guns hidden in guitar cases. Not long after, Pyle spots men dressed in full KKK regalia handing out pamphlets at street corners in town.

Slurs and taunting became less frequent in high school, Pyle said, but he remained a target. Extra police were assigned to one of his basketball games in a nearby town out of concerns that he might be attacked because of his skin color.

"All of it messed with my head," Pyle said. "Being looked at and laughed at and called a [racial slur] every day takes a toll, and after awhile you start to feel like there's something wrong with you."

Pyle said he often wonders if his traumatic childhood is partly to blame for why he sought refuge in drugs and alcohol. His troubles reached their apex two years ago, when he had to choose between paying his back rent or buying more painkillers. He chose the drugs, figuring that without opiates, he would become so overwhelmed with anxiety and depression that he couldn't function at his job as a cook. And without the work, he would have no money for food or clothes.

Before long, Pyle no longer had to call dealers. They came directly to him, often showing up at the back door of the restaurant with a diverse selection of cocaine, methamphetamines and fentanyl-laced painkillers. On paydays, dealers would circle the restaurant, knowing he had money to buy. Pyle would wrap up his shift near midnight and then make his way to a shelter, where he would sleep in clothes still smelling of kitchen grease.

"The worst part of being homeless is the fatigue," Pyle said. "You can't think clearly because you're mentally and physically exhausted all the time."

But on a morning last April, Pyle awoke at the Higher Ground homeless shelter in downtown Minneapolis to startling news: Hennepin County was moving dozens of people to rooms in a nearby hotel to protect them from the fast-moving coronavirus. For the first time in 18 months, Pyle slept in a private room with a locked door and without fear that someone would roust him at night or steal his belongings.

The move marked a turning point in Pyle's long battle with substance abuse. Dealers were no longer stalking him, asking him if he "was straight," slang for ready to buy. His back and joints no longer hurt from sleeping on hard bunks or benches. When an apartment finally opened at an affordable housing complex near downtown, he seized the opportunity and moved in just before Christmas.

"It was unbelievable, really, to be able to lay down on a regular bed and not worry about someone coming up on you or stealing your stuff," he said.

Slowly, Pyle is rebuilding his life. He takes a dose of methadone each morning at a nearby Hennepin Healthcare clinic to reduce his cravings for opioids and has been actively looking for work. He also has rekindled relationships with his sons — Gavin, 27, and Garrett, 21 — who live in Madison, Wis. On a snowy evening in February, he called Gavin on FaceTime while grilling cheeseburgers outside his sister's arts and music studio in south Minneapolis. The two chatted about college basketball, Gavin's car troubles, and plans for a long road trip this spring.

"I love you, man!" Pyle shouted into his phone.

"Talk to you soon, Papa," Gavin replied.

Now that he has a place to call home, Pyle has been pouring out his thoughts and memories of his childhood into a small notebook he keeps near his bed. His plan is to one day organize the notes into a book so that others could learn from his experiences.

"I came so close to losing everyone who was important to me, but I never gave up hope," he said, reciting a line from his journal. "No matter what you're going through, you can't lose that feeling — that hope."

Chris Serres • 612-673-4308

Twitter: @chrisserres