Updated

Once Santa Maria police discovered one of their own was possibly having sex with a 17-year-old girl they set up a ruse to get him to cop to the crime.

The decision to draw out a confession from Officer Alberto Covarrubias set in motion a series of events that led to his death when a fellow officer — the best man at his wedding — shot and killed him after police tried to make an arrest.

On Tuesday, Santa Barbara County District Attorney Joyce Dudley said Officer Matt Kline, a five-year veteran, was legally justified in killing Covarrubias in January.

In clearing Kline of wrongdoing, Dudley's 18-page report provided some answers to the larger question posed by Covarrubias's family: Why did police try to arrest him while he was armed with his service pistol?

Covarrubias, 29, was ending his shift at a DUI checkpoint when he was shot in a scuffle as police moved in to arrest him for investigation of having sex with the girl, a member of the department's Police Explorer program.

Police learned about a possible inappropriate relationship between the girl and Covarrubias two days before the shooting. The girl told investigators she had sex with Covarrubias and agreed to participate in a ruse where she would tell him she might be pregnant with his child, according to the report.

Shortly before the shooting, the girl called Covarrubias and told him about the pregnancy and that he was the only person who could be the father of the child.

Covarrubias asked the girl to deny they had sex and said he would kill himself if their relationship was made public, the report said.

"'You know, I'll be honest with you, I won't go to jail,'" Covarrubias tells the girl, according to the report. "'I'll go out, but I won't go to jail.'"

Covarrubias adds: "'But like I said, if it gets out that it's mine, if you tell anybody, or this is a set up ... I'm done girl.'"

Police then made the decision to arrest Covarrubias at the DUI checkpoint, even though at least one superior was concerned about arresting an armed officer among other officers, most of whom had no idea that Covarrubias was under investigation.

Another high-ranking officer said the reason for making an arrest immediately was because Covarrubias "may be suicidal and had told someone that he wasn't going to be taken alive," the report said.

Two sergeants — one of them the officer's cousin — approached Covarrubias but he backed away. Covarrubias drew his gun and fired one shot, but didn't hit anyone, the report said. Security camera video from a nearby business captured some of the struggle.

One of the sergeants pleaded for help from fellow officers as Covarrubias did not let go of his gun. When Kline noticed the two sergeants were in "the fight for life," according to the report, he pulled out his weapon and shot and killed Covarrubias.

"'Was it Cova?'" Kline asked one of the sergeants. When Kline was told he had shot his friend, he became even more upset, the report said.

"'I (expletive) shot him. I had to shoot him. He pulled a gun out and shot at the sergeants,'" Kline said.

The Office of Independent Review, a Los Angeles County law enforcement watchdog, is conducting a review of Santa Maria's police procedures. It's not known when the agency will finish its investigation.