San Francisco will close its juvenile hall by the end of 2021, a nearly unanimous decision made by the Board of Supervisors on Tuesday that ends the longtime practice of holding children in cells while they await their judicial fate.

The extraordinary action makes San Francisco the first major city in the country to shut down juvenile hall in an effort to eliminate the jailing of children, supervisors said.

“For me this is about history,” said Supervisor Ahsha Safaí. “We incarcerate more people ... than any other country in the world. We have a culture of incarceration.”

It’s time to do something about that, he said.

Ten supervisors supported the ordinance and one, Catherine Stefani, voted against it, calling for additional community input prior to such a drastic step and before real alternatives are in place.

“I think we all know we can do better and things need to change, and we need to put our youth first,” Stefani said.

Supervisors drafted the proposal following a recent Chronicle report that documented a dramatic drop in serious youth crime that has left the state’s juvenile halls nearly empty and per-inmate costs skyrocketing.

After the vote, celebratory cheers echoed into the supervisors’ chamber from the hallway outside, forcing speakers to temporarily halt the meeting.

“I’m just so happy,” said Tenaya Jones, 18, who spent time in juvenile hall last year and was with a group of advocates from the Young Women’s Freedom Center celebrating after the decision. “All my siblings, my brothers and sisters, won’t have to go through this anymore. They’re going to get the help they need.”

The ordinance requires the creation of a task force to develop home-like and rehabilitative centers in San Francisco to house youth offenders, including a secure site for those who pose a public safety threat.

The board must review and approve final plans six months prior to the closure.

“We can do better by our kids in San Francisco,” said Supervisor Shamann Walton, who co-sponsored the measure. “I want to be clear that we would never put a system in place that is worse than our current juvenile hall.”

Supervisor Hillary Ronen, a co-author of the measure, said that the jail-like environment in juvenile hall can cause irreparable harm to young people. When detained, she said, youths must remain silent while eating, are regularly strip-searched and are punished by being confined to their cells behind locked steel doors.

“This is what the kids in juvenile hall deal with, so no wonder that study after study shows that when kids leave juvenile hall, they come out worse than when they went in,” Ronen said.

Despite a veto-proof majority, Mayor London Breed said prior to Tuesday’s meeting that she doesn’t support the measure.

Breed called for a moderate approach to wait for the results from a blue-ribbon panel she created in April — after the legislation was announced — to look into ways to reform the county’s juvenile justice system. The panel’s focus is addressing ways to reduce incarceration and racial inequities as well as how best to use the detention facilities, including the mostly empty juvenile hall. A report isn’t due until the end of the year.

“Who wouldn’t want to close juvenile hall and make sure we’re not locking up young people?” she said. “But we also know there are still challenges that might exist, and we need to be prepared for those.”

Breed said she is concerned that if juvenile hall is closed, San Francisco would have to send young people to another county when a judge orders detention.

Supervisors, however, have said that would not be necessary, since the legislation requires creation of community-based facilities, including a secure environment for those who need it. Those settings would include mental health services, job training and other support systems, Walton said.

San Francisco’s 150-bed juvenile hall is typically less than a third full, pushing the annual cost to incarcerate a child to $374,000 in 2018, up from $135,000 in 2011.

There are currently 39 youths held in the facility, with an average stay of 23 days last year, county officials said.

The San Francisco Probation Department directed $11.9 million to juvenile hall last year, an amount that has remained relatively flat since 2011, even though the average daily population has been cut in half. The new ordinance urges the county to redirect savings to youth programs.

The effort to close juvenile hall had widespread support among public officials and community organizations, including District Attorney George Gascón, Public Defender Mano Raju and the Young Women’s Freedom Center, which has been advocating for the facility’s closure for years.

“This is what innovation truly looks like — we need to transform the systems that oppress and harm too many of our young people, families and communities, and instead invest with what helps us thrive,” said Jessica Nowlan, executive director of the center, in a statement.

Critics of the idea — including San Francisco Juvenile Probation Chief Allen Nance and representatives from local chapters of the NAACP — have called on the supervisors to keep the facility open and update its treatment programs.

Nance said he has concerns that 2½ years is not enough time to create and implement alternative settings for youth offenders.

“It will be a real challenge to do that,” Nance said. “There are entities outside of my department and outside the city and county of San Francisco that would have to look at those plans, approve those plans and look at the feasibility and suitability of whatever vision is created.”

Nance added that key stakeholders were not consulted before the measure was introduced, including leaders in the African American community and the San Francisco Juvenile Justice Commission.

At times, outbursts from opponents disrupted the Tuesday meeting.

Rev. Amos Brown, president of the San Francisco NAACP branch, interrupted Walton, chanting, “Tell the truth,” as the supervisor described his experience as a youth held in juvenile halls.

When board President Norman Yee ordered Brown removed from the chamber for his outbursts, he responded by saying: “He wouldn’t meet with us; he wouldn’t meet with us.” Brown was later allowed to stay for the meeting.

In a statement, he called on supervisors to consider African American youths, who make up the majority of those in juvenile hall, saying he was concerned they would be “shipped out of town to other facilities.”

“If we close down juvenile hall, where will violent or sexual offenders and those with mental health issues go?” Brown asked. “Through sensible, respectful conversation, we should tweak the facility and amend it, but not end it.”

Supervisors have said that if juvenile hall closes, there will be community conversations about what to do with the facility, including possible uses to address homelessness or mental health needs, among other ideas.

Chronicle staff writer Trisha Thadani contributed to this report.

Jill Tucker and Joaquin Palomino are San Francisco Chronicle staff writers. Email: jtucker@sfchronicle.com, jpalomino@sfchronicle.com Twitter: @jilltucker @joaquinpalomino