CALDWELL -- Prosecutors have agreed as part of a plea deal not to seek the death penalty for a Meridian defendant accused of breaking into his estranged wife's house and gunning down another man.

Phillip Cabrera, 39, pleaded guilty to first-degree murder and assault on a law enforcement officer Wednesday.

He was arrested after the April 28, 2017 shooting of 34-year-old Andrew Shepard of Caldwell. According to court documents, Cabrera told officers he drank and snorted cocaine before driving to his estranged wife's home on Bear Valley Drive in Nampa, bringing along seven guns.

MORE: Police: Murder suspect slashed tires, kicked in doors before Nampa shooting

When he found Shepard's car parked outside the trailer, he said, he slashed all four of the tires, then returned to his vehicle to retrieve his "favorite" guns - an AR-15 and a .45 handgun.

In a call to 911, Cabrera's wife told dispatchers the suspect was outside her home with a gun, trying to get the windows open. While she was still on the phone with emergency services, Cabrera broke down the front door.

RELATED: Meridian man charged with murder in Nampa shooting

Shepard and Cabrera's wife barricaded themselves in a bathroom, along with her children - a 9-year-old and a 10-month-old baby. The woman told officers that Cabrera kicked down the bedroom door and forced his way into the bathroom to get to them, before shooting Shepard first in the abdomen, then in the head.

The 911 call captured the sound of multiple gunshots, along with the woman screaming and Cabrera shouting "you cheated on me." Cabrera's estranged wife and their children were not injured in the shooting.

Prosecutors say Cabrera also pointed a gun at the first officer to arrive on scene, and fired several shots out the front door of the mobile home. According to court documents, Cabrera later told detectives he had seen the police lights and assumed he would be "in a big shootout with the cops like on TV/movies."

PREVIOUS: Cabrera pleads not guilty to murder

Cabrera said he considered committing suicide, but ultimately decided to surrender to the officers, and was taken into custody. He has remained held in the Canyon County Jail since his arrest.

Judge Thomas J. Ryan must still decide whether to accept or reject the plea deal, which also drops charges of unlawful discharge of a weapon, injury to a child, malicious injury to property, burglary and use of a deadly weapon in the commission of a felony. If Ryan does not accept the plea agreement, Cabrera would be allowed to withdraw his pleas, and the death penalty could be back on the table.

Cabrera is set for sentencing June 4.