ALBUQUERQUE, N.M. — An Albuquerque police officer trained to handle encounters with the mentally ill had spent more than an hour with a homeless man on a hillside, telling him to drop his knives while making limited progress in negotiations before tactical officers moved in to replace him.

Officer Mikal Monette, who is specially trained in crisis intervention, testified Tuesday in the trial of two officers charged in James Boyd’s 2014 shooting death. He recalled trying to calm Boyd, who suffered from schizophrenia and had shouted death threats at officers. Police originally were called by a resident to Boyd’s illegal campsite, where authorities say he brandished two knives when officers arrived.

“I believe he said he didn’t understand why we were up there because he wasn’t causing any harm,” Monette said, while under questioning from a prosecutor. “He did say he felt his knives were protecting him as much as our guns were protecting us.”

Special prosecutor Randi McGinn argues that a series of flawed decisions by police — from removing Monette to rushing a plan to deploy a flash-bang grenade, a K-9 and other less lethal force — escalated the encounter and led to Boyd’s shooting death.

The trial underway for now-retired Detective Keith Sandy and former Officer Dominique Perez, both charged with second-degree murder in Boyd’s death, has placed focus on law enforcement encounters with the mentally ill at a time when shootings by officers of black men have sparked widespread debate over policing in the U.S.

Boyd, 38, was diagnosed with paranoid schizophrenia, had a history of violence and had clung to a persona of a U.S. Defense Department official during the standoff in the Sandia Mountain foothills.

Much of McGinn’s case during the first seven days of the trial has targeted Sandy, more so than Perez, saying the detective was behind some of the decisions that sent the standoff into chaos, including the one to interrupt Monette’s negotiations.

Sandy’s defense team raised the point that the two officers never worked together or interacted the evening of the standoff that ended with Boyd being shot.

Sandy, who retired the year of the shooting, was a member of an elite but controversial team designed to track and apprehend violent career criminals. Known as the Repeat Offenders Project, it was dismantled after the U.S. Justice Department found a “culture of aggression” among Albuquerque police.

An investigation by the Justice Department into more than 20 fatal police shootings between 2010 and 2014 led to court-ordered reforms within the Albuquerque Police Department, including a new use-of-force policy, and SWAT and crisis intervention training.

Perez was a member of the SWAT team, and he was called to the standoff by a sergeant. The former officers’ attorneys argue the shooting was justified.

On March 16, 2014, the talks between Monette and Boyd had reached a point where Boyd agreed to keep the knives in his pockets but remained agitated when asked to surrender them completely, Monette said.

Seventy minutes into negotiations, Sandy and others replaced Monette, who had resolved every one of the hundreds of crisis situations he had negotiated with the Albuquerque Police Department.

A short time later, McGinn said Sandy deployed the flashbang grenade to disorient Boyd so officers could take him into custody, but it went off farther from Boyd’s feet than planned and he drew his knives before officers fired. Sandy’s bullets struck Boyd in each arm, while a round from Perez hit Boyd in the back.

The prosecution and the former officers’ attorneys have disputed whether Boyd was turning away from police when he was shot or taking a step toward a K-9 handler.