ALBUQUERQUE, N.M. (AP) — A New Mexico judge ruled Tuesday that two police officers must stand trial on murder charges in the on-duty shooting of a homeless man whose killing was caught on video and sparked national outrage while fueling reforms at the Albuquerque Police Department.

Pro Tem Judge Neil Candelaria said after a nearly two-week preliminary hearing that there was probable cause for the murder case against Officer Dominique Perez and former Detective Keith Sandy to go to trial.

Video of the 2014 shooting taken with an officer's helmet camera showed 38-year-old James Boyd gathering his belongs and appearing to surrender after an hours-long standoff in the foothills of the Sandia Mountains.

Police then detonated a flash bomb near Boyd, who dropped his bag and pulled two knives before Perez and Sandy shot him as he fell to the ground.

Police had been called to the scene over a report of an illegal camper. Boyd, who authorities said was schizophrenic, died at a hospital after his arm was amputated.

Only seven police officers around the country have faced murder charges for on-duty incidents since 2010. One was convicted of manslaughter and assault after a second-degree murder count was dropped. The rest are still in court proceedings.

After the ruling in New Mexico, defense lawyer Sam Bregman asked Candelaria what standard he used to justify probable cause. The judge replied, "What a reasonable police officer in that situation would do."

Defense lawyers did not immediately comment after the ruling.

Special Prosecutor Randi McGinn said during the hearing that Perez and Sandy came to the scene with the intent of attacking Boyd during a "paramilitary response" and created the danger.

"He was shot in the back and in the side," McGinn said during her closing argument. "That shows that he was not a threat when they shot him."

Defense lawyers countered that Boyd had threatened officers with two knives and Perez and Sandy had no choice about opening fire. The lawyers said the officers were following their training and protecting their colleagues.

"It should be clear to everyone now that James Boyd was not executed for being a homeless camper," defense attorney David Roman, who represents Perez, said in his closing argument.

During the hearing, Bregman, who represents Sandy, questioned K-9 officer Scott Weimerskirch from a 4-foot platform to illustrate whether Boyd being on higher ground was a threat to Weimerskirch and other officers at the scene.

Holding fake knives, Bregman asked if Boyd's actions put officers in danger. Weimerskirch answered yes.

"I was in a helpless position ... trying to control my dog," Weimerskirch said, crediting Sandy and Perez for saving his life.

Weimerskirch also testified that he ducked when he approached Boyd because he knew Sandy and Perez would fire at the camper.

Sgt. James Fox said officers who arrived at the scene knew basic information about Boyd when they received reports about him camping illegally. But it was unclear from the testimony if Perez and Sandy knew the details of Boyd's mental illness.

At the time of the shooting, the Albuquerque Police Department was being investigated by the U.S. Justice Department over use of force after police were involved in more than 40 shootings since 2010.

Perez and Sandy were the only officers charged in any of the shootings.

The killing of Boyd generated angry protests that included a sit-in at the mayor's office and the closing of City Hall when a City Council meeting was interrupted.

Police were forced to use tear gas to breakup demonstrations later in the year in Albuquerque before the nation watched similar scenes in Ferguson, Missouri, after a white police officer killed an unarmed 18-year-old black man.

Shortly after the killing of Boyd, Justice Department officials released a harsh report faulting Albuquerque police for excessive force, especially against suspects suffering for mental illness.

The city and the Justice Department later reached an agreement to overhaul policies involving use of force and to appoint a federal monitor to oversee reforms.

___

Follow Russell Contreras at http://twitter.com/russcontreras