On a cool, cloudy July afternoon last year, San Francisco police officers patrolling near U.N. Plaza noticed a man acting strangely — more strangely than the average Civic Center wanderer. Believing he might be armed, the officers asked him to show his hands. He refused.

The officers fired beanbag rounds at him. From there, things could have quickly spun out of control, but they didn’t. The man lay face-down on the ground in front of the historic Hibernia Bank, where he remained for hours, refusing to cooperate. Streets around him were shut down, which clogged traffic but gave the situation some breathing room.

The man — who indeed had a gun — threatened to hurt himself; he said several times that he wanted police to take his life, according to then-Acting San Francisco Police Chief Toney Chaplin. Officers relayed messages from the man’s family, hoping to anchor him to the world of the living. After more than three hours of tense negotiations, they were able to get him to safety.

“We would’ve stayed out here until tomorrow,” Chaplin told the San Francisco Chronicle. “The bottom line is, we were able to resolve it because we had enough time.”

Mayor Ed Lee later praised the officers for their de-escalation skills.

On that afternoon, the police were, in some ways, lucky. When someone is trying to get police officers to kill them, they often do so by trying to force the situation into a crisis quickly, says Joel Fay, a psychologist and retired San Rafael Police Department officer who now teaches cops how to defuse such situations.

People seeking “suicide by cop” will often immediately confront and challenge the officers who respond, advancing at them with a weapon and denying them the opportunity to plan a level-headed response, Fay says. About a third of officer-involved shootings fall into this category.

“It’s a very popular way to die,” he recently told a room full of city park rangers and police dispatchers as part of the police department’s crisis intervention training.

The key, Fay says, is to create a sense of ambivalence in the subject, essentially so they lose their nerve. “If I can talk you out of committing suicide today, there’s a 94 percent chance you won’t try it again.”

In late 2015, California legislators passed two new laws requiring police officers to receive at least 15 hours of crisis intervention training, says San Francisco police Lt. Mario Molina, who specializes in such training. Since 2012, the SFPD has provided a 40-hour crisis intervention course for officers and other city workers who might need it — the park rangers, for example.

Former Police Chief Greg Suhr made the training mandatory in 2012, Molina says. That order came after officers shot and killed a mentally ill man, Vinh Bui, in the Portola neighborhood in December 2010 and an unidentified man in a wheelchair in SoMa in January 2011.

To date, about a third of the police force has funneled through the program, where they hear from experts like Fay and Christopher Weaver, director of the Forensic Psychology Program at Palo Alto University and an expert on post-traumatic stress disorder.

Over four 10-hour days, officers learn about managing fatigue, overwork and suicidal thoughts, about the trauma experienced by low-income families of color, about how to approach people who are autistic or mentally ill, as well as verbal de-escalation techniques for crisis situations.

Because the program requires coordinating the schedules of police and psychological experts from around the country, trainings take place a few times a year, Molina says. He expects it will take four to five years to train every officer. But the training is a crucial part of police work.

“You learn to ask questions before you show up, like, ‘Is this person on any medications? Are they a veteran? Do they have any bad reactions to police uniforms, or to lights and sirens? That way, you can develop a plan,” Molina says.

When Weaver talks to police about veterans with PTSD, he reminds them that, for some folks, the sight of a person in uniform is enough to trigger a flashback, shocking them out of their ability to remain calm and present.

“You all are triggers,” Weaver says during his PTSD class. When that happens, officers can help PTSD sufferers get back to reality by asking them to name something they see nearby, as well as something they hear and something they can feel with their bodies. And, if it’s safe, officers can crouch down next to them. “That gives the other person a sense of control,” he says.

Weaver also teaches officers about unconscious biases they may have about people of different races, and how those biases influence split-second decisions.

“Everyone has it,” he says. “One day, I’m walking my kids when a Black man approaches. I grab my kids and give him a wider berth, and then I realize, ‘Shit, I teach this stuff!’ And I turn around and awkwardly say, ‘Hi!’ to him.”

Weaver says that when he taught San Francisco’s SWAT team about unconscious bias, he got a lot of push-back from officers who said they didn’t have the luxury of time to recognize when their implicit feelings about someone are influencing their judgment.

“But it’s not about slow versus fast,” Weaver says. “It’s about getting over to your explicit brain, and to do that, you have to practice it a lot.”

Critics of the police department’s use of force say there’s clearly bias at work, given the number of officer-involved shootings over the past couple of years, including Alex Nieto, Mario Woods, Luis Gongora, Jessica Williams, and Sean Moore.

“The thing is, the police already know how to police in White neighborhoods,” says Phelicia Jones, a leader with the organization Wealth and Disparities in the Black Community, Justice 4 Mario Woods. “They know how to use crisis intervention training, but when it comes to Black neighborhoods, all of a sudden they don’t know how to police. They don’t know how to use judgment.”

Three of the five officers involved in the shooting death of Woods, and one of the three involved in Nieto’s death, had gone through the training, according to police department spokeswoman Giselle Talkoff. So had one of the two officers who were present when Gongora was killed.

Molina says that not every situation lends itself to de-escalation. Statistics show that most shootings happen within the first 90 seconds that officers arrive on a scene. “Sometimes it’s a split-second decision you have to make,” he says.

Indeed, it appears that officers opened fire on Nieto and Gongora within moments after police arrived; with Woods, the shooting began in the first few minutes.

“We’re taught, ‘Do you need to protect yourself or someone else? Or can we calm everyone down?” says Don Anderson, a SFPD officer who helps organizing the training program. “There are times when force may be used, but if you have time to think about de-escalating, then you have time to de-escalate.”

As police officers continue to move through the training course, a rift has opened between the officers’ union and the city over a new use-of-force policy adopted in December. The Police Officers Association sued San Francisco late last year, claiming that some elements of the new policy, including a ban on shooting at moving vehicles and another on a restraint hold known as “the carotid,” put officers in danger.

The carotid hold isn’t the same thing as the more lethal chokehold, and is an important tool for smaller officers who need to bring a suspect under control, says Gregg McLean Adam, the police union’s attorney. “If you take away the carotid, he’s going to have to shoot,” Adam says.

Adam says the city’s refusal to let police carry Tasers is another factor driving up the potential for shootings. “We need to give officers more options for relief of force.”

Suhr said after Woods’ shooting that a Taser could have prevented his death, but others in the city — notably San Francisco Police Commissioner Petra DeJesus — have said that Tasers come

with their own set of problems, including that they can be lethal when used on people with health problems.

Molina notes that, overall, the SFPD’s track record on dealing with crisis situations is pretty good. Of the 4,602 calls for mental-health detentions the department received in 2015, the vast majority were provided psychiatric services, while 71 were cited for misdemeanors and 29 were booked on felony charges. The department received a similar number of calls in 2014 and 2016, according to Talkoff.

“When you look at the amount of calls where no deadly force was used, it’s most of them,” he says.

The city is still closely studying the case of Moore, a mentally ill Black man who was shot and injured by San Francisco Police officers in January. Moore was verbally abusive when the police arrived, but he was unarmed.

David Carlos Salaverry, a member of the San Franciscans for Police Accountability, wrote in SF Weekly recently that it doesn’t look like officers followed their de-escalation scenarios or their use-of-force policy when they shot him. Neither of the responding officers had been through the training, Talkoff says.

During his class on intervening with mentally ill subjects, Fay runs through a number of cases in which police shot and killed mentally unstable individuals, revealing moments when officers attacked someone who was cooperating, or could have slowed things down but didn’t. He acknowledges that officers don’t want such moments to turn deadly either, and reminds them to avoid acting in ways that can drive tensions higher.

“You can show up and say, ‘We don’t have time for this,’” as one officer did in the 2014 death of mentally ill teenager Keith Vidal in North Carolina, “but if you do, you’d better make sure nothing bad happens,” Fay says.

Instead, he urges police to change the tone of a situation by taking some slow, deep breaths and calmly asking the subject what they need. Usually, thanks to mirror neurons, this will help the subject calm down, too.

Correction: An earlier version of this story incorrectly suggested that Lt. Mario Molina said Chief Greg Suhr had made crisis training mandatory for all officers in 2012, a year after officers had shot and killed a mentally ill man. Although the training was indeed made mandatory in 2012, and although at least one mentally ill man was fatally shot by SFPD officers in the year prior to that decision, Molina never stated that the decision was the result of a shooting. We regret the error.