A Washington state man on Monday pleaded guilty to murder and attempted murder for shooting up a party that his ex-girlfriend attended in July.

Allen Ivanov, 20, killed three people and injured a fourth person when he opened fire in Mukilteo, an affluent Seattle exurb, with an "AR-15 type" rifle on July 30, police said.

On Monday he pleaded guilty to three counts of murder and two counts of attempted murder and faces life in prison without parole, but he will avoid the possibility of the death penalty, NBC affiliate KING in Seattle reported.

Ivanov was upset because his ex-girlfriend was ignoring him and went to the party to kill her, police said in court documents.

A day before the rampage, he texted a friend who suggested he kill some deer instead of the ex-girlfriend, and Ivanov replied: "no. I'm killing everyone at a huge party," according to court documents.

As Ivanov watched the party from afar for two hours, he read the instruction manual for the weapon and then approached, killing two men and wounding a third, before entering the home where he killed his ex-girlfriend, police said. Ivanov then shot at others fleeing from a balcony.

Ivanov is scheduled to be sentenced on Jan. 12, according to Snohomish County Superior Court records.