San Francisco is set to become the first major city in the US to shut down its juvenile detention center, after lawmakers voted to close the facility by the end of 2021.

The city is now tasked with creating a new program for youth offenders that will includea secure facility, but one focused on rehabilitation. The facility should feel “more like a school or a wellness center rather than a jail or a prison”, said the city supervisor Hillary Ronen, one of the sponsors of the legislation.

The push to shut down the city’s juvenile detention center came as youth crime and juvenile felony arrests dropped throughout the state. However, San Francisco continued to spend $13m a year on a facility that remained, at times, three-quarters empty, Ronen said.

Gun violence has sharply declined in California's Bay Area. What happened? Read more

And for the youth stuck inside, studies have shown time and time again the damage that incarceration can do to personal development.

“It just doesn’t make sense any more in this day or age, with all our modern understanding of the youth brain, to keep using these outdated modes that are extremely expensive,” she said.

The near-unanimous decision had overwhelming support from city lawmakers, with eight of the 11 lawmakers co-signing the legislation. The legal action was spurred by a San Francisco Chronicle report that found the city spent $300,000 per youth in juvenile detention, despite a declining population.

The battle to close the detention center was personal for at least one lawmaker. Twenty-seven years ago, Supervisor Shamann Walton was one of those kids in juvenile hall, spending time in custody for crimes like armed robbery and possession of a firearm.

As an elected official, he returned to a detention center and realized the experience was almost exactly the same as it had been for him when he was a kid.

“You’re still walking the line, you’re still sleeping on concrete, you’re still doing workbooks and not working with a teacher, you’re still spending more time in your room, isolated, not having the opportunity for mental health help, or to gain life skills or social skills,” he said. “Something needed to change.

“The only thing I learned from juvenile hall was how to be resilient and how to endure a locked-up experience, which only prepares you to be in county jail or prison,” Walton said. “Nothing I learned in juvenile hall prepared me to make the change I needed to get to where I am today, and the same thing is happening to far too many of our young black and Latino people.”

He hopes that by closing down the juvenile detention center and developing a new, rehabilitation-focused program for youth offenders, he will be able to provide future generations of kids that same opportunity to end the cycle of criminality that he was afforded.

“We have to set our young people up for success and do it with the bold change that it requires,” he said. “We have a couple years to reimagine and reinvent the current structure, and I’m excited.”