SEAL BEACH, Calif. (KTLA) -- Court documents are providing hints about what triggered a shooting spree at a Seal Beach salon that left eight people dead, including the alleged shooter's ex-wife.

On Wednesday, authorities released the police affidavit detailing how and why suspect Scott Dekraai says he carried out the alleged shooting rampage.

The documents give a chilling account of how he planned to gun down his ex-wife, Michelle Fournier, at the Seal Beach salon where she worked.

"I think it's absolutely devastating," Nadia Keilani, who knew Fournier and some of the other victims, told KTLA. "I guess, you know, he went to an edge, and it's unbelievable."

According to the documents, Dekraai says he argued with his ex-wife the morning of the shooting over child custody issues involving their 8-year-old son.

He says he son would often come home from Fournier's home with bruises.

After the argument, Dekraai says he went to his Huntington Beach home, armed himself with weapons and ammunition and put on a bulletproof vest.

He says he then drove to a nearby beach, sat in the sand and contemplated shooting Fournier.

Dekraai then allegedly drove to Salon Meritage, where he shot Fournier first, followed by salon employee Christy Wilson, who had testified at a recent child custody hearing on his ex-wife's behalf.

Dekraai says he shot salon owner Randy Fannin because he came at him with scissors.

And, he fired at a man sitting outside in a Range Rover because he thought he was an off-duty cop reaching for a weapon.

As for the other victims shot inside the salon, Dekraai says they were simply "collateral damage."

Dekraai was pulled over shortly after he left the salon.

He immediately got out of his car and put his hands in the air, according to the affidavit.

When a police officer was placing paper bags over Dekraai's hands to preserve gunshot residue, Dekraai told the officer, "I know what I did."

Police found three guns in Dekraai's truck, along with $959.05 in cash. They seized an additional seven guns from his garage.

Dekraai is charged with eight counts of murder.

Prosecutors say they will seek the death penalty.