A former military contractor avoided jail on Friday for the revenge killing of a handcuffed Afghan detainee who had doused one of the contractor's colleagues with gasoline and set her on fire.

Don M. Ayala, 46, of New Orleans, pleaded guilty to a manslaughter charge that normally would carry up to eight years in prison. But U.S. District Senior Judge Claude Hilton decided a sentence of probation was justified under the horrific circumstances that led Ayala to shoot and kill Abdul Salam in the village of Chehel Gazi in Afghanistan on Nov. 4.

"The acts that were done in front of this defendant would provide provocation for anyone who witnessed the scene," Hilton said. "This occurred in a hostile area, maybe not in the middle of a battlefield, but certainly in the middle of a war."

Minutes before the shooting, Salam had been talking to anthropologist Paula Loyd, who along with Ayala was part of what the Army calls a Human Terrain Team, in which social scientists are embedded with the military to help them understand and navigate Afghani culture.

Without warning, Salam tossed a pitcher of gasoline on Loyd and lit her on fire. Soldiers dragged Loyd, 36, to a sewage-filled drainage ditch to put out the flames.

When others told Ayala how badly Loyd was injured, Ayala pointed a 9mm pistol to Salam's temple and pulled the trigger.

Salam died instantly. Loyd did not. With second- and third-degree burns covering 60 percent of her body, she lingered for two months before dying on Jan. 7 at Brooke Army Medical Center in San Antonio, Texas.

The Taliban claimed responsibility for the attack.

At Friday's sentencing hearing, Ayala's supporters filled the courtroom and let out a collective sigh of relief when Hilton announced that he would not send Ayala to prison and was instead imposing probation for five years and a $12,500 fine.

Prosecutors had argued for a "significant" prison term. Prosecutor Michael Rich acknowledged that the eight-year term called for under federal sentencing guidelines was too severe but said some period of incarceration was needed to send a message that Ayala's actions are not condoned.

Rich said the morality of Ayala's actions are debatable, "but what he did was most assuredly not legally right."

"While his actions are understandable, they are not excusable," he added.

Rich said Ayala violated one of the most basic rules of law: "You don't shoot prisoners."

Ayala, who in previous assignments had been a personal bodyguard for Afghan President Hamid Karzai and Iraqi Prime Minister Nouri al-Maliki, made a brief statement to the judge before he was sentenced, saying he wished the events on that day had never occurred. He declined comment after the hearing.

Ayala offered this explanation in court papers: "I was overcome by the horror of what he had done to her, knowing that she was suffering and that she would never be the same, even if she lived. Immediately after the incident, I was allowed to go see Paula. I will never forget hearing Paula cry 'I'm cold' over and over as the medic tried to treat her wounds."

Ayala's father, David Ayala, said after the hearing he was grateful for all the support his son received in recent months.

"He's tough ... but after the incident, it took a lot out of him," the elder Ayala said.

Loyd's family has been among Ayala's strongest supporters. Loyd's mother, Patricia Ward, noted in a letter to the judge that several of Loyd's friends offered to serve Ayala's time for him.

"His reaction was perfectly normal in my mind," wrote Ward, who said that she likely would have done the same thing.

Ayala initially was charged with murder — the first military contractor charged with the crime while serving in Iraq or Afghanistan.

He pleaded guilty in February to voluntary manslaughter, which exposed Ayala to as much as 15 years in prison but also offered defense lawyers the opportunity to seek probation.

Federal public defender Michael Nachmanoff argued that Ayala, who spent three weeks in solitary confinement in Afghanistan before being brought to the United States to face charges, had been punished enough.

"But for Mr. Salam's terrorist act, we would not be here," Nachmanoff said. "The public does not need to be protected from Mr. Ayala."