© ReutersThe alleged gunman, Scott Evans Dekraai, was involved in a custody dispute with his ex-wife
Prosecutors say they will seek the death penalty in the case of a man who allegedly went on a shooting rampage in a hair salon in Seal Beach, California.

Scott Dekraai, 42, has been charged with eight counts of murder and one count of attempted murder.

He was arrested a short distance from the salon - where his ex-wife worked - moments after Wednesday's attack.

Meanwhile, police have released the names of the eight shooting victims, confirming local news reports.

Orange County District Attorney Tony Rackauckas said on Friday that the shootings were triggered by a long-running custody dispute with Mr Dekraai's ex-wife, Michelle Fournier.

She was one of those shot and killed at the salon.

One gunshot victim, Hattie Stretz, 73, is alive and recovering at a local hospital, according to the Associated Press.

In addition to Ms Fournier, the victims include: her friend Christy Wilson; the salon's owner Randy Fannin; Victoria Buzzo, a stylist at the salon; Laura Elody, Ms Stretz's daughter; Lucia Kondas, Michele Fast, and David Caouette.

'End any life'

According to Mr Rackauckas, Mr Dekraai carried three guns and wore a bulletproof vest when he entered the salon, shooting several victims in the head and chest at close range.

© ReutersMourners in Seal Beach have been holding vigils outside the salon
He allegedly then walked outside and shot another victim in the parking lot.

"He was willing to end any life in his path, and he did," Mr Rackauckas said.

At least 15 people were inside the salon at the time of the attack.

The small community of 25,000 is in mourning. Several hundred people attended a prayer service at a church across from the salon on Thursday night.

More than 1,500 showed up with candles for a vigil in the parking lot of the salon.

Seal Beach has seen only four murders in the past decade. Police from nearby towns have been assisting with the investigation.

"A crime of this magnitude is not something Seal Beach is familiar with," Sgt Steve Bowles of Seal Beach police told reporters on Wednesday.

Restaurant refuge

Patty's Place, a restaurant next door to the salon, became a refuge as the shooter opened fire.

Ron Sesler, 68, who was working at Patty's, told AP he heard the gunshots and watched as stylists and customers, some in the midst of having their hair dyed, fled into the restaurant. He locked the door while his wife dialled 911.

Police used the restaurant as a temporary base for witness interviews.

Click here to watch the video.

"The whole place was filled, it was whoever survived," said Mr Sesler. "We just locked the doors and waited for police. It seemed like a long time - minutes - but it was probably seconds."

According to Mr Sesler, witnesses interviewed said Mr Dekraai first took aim at Mr Fannin, then turned to his own ex-wife, shooting her three times.

Others in the salon, including Mr Fannin's wife, Sandy, survived by hiding in back rooms of the salon.

Threatened to kill

Mr Dekraai and Ms Fournier reportedly separated in 2007, several months after a boating accident where he was permanently injured and saw a colleague die.

He was diagnosed in 2008 with post traumatic stress disorder, according to court documents.

Ms Fournier claimed in court papers filed during their divorce proceedings earlier this year that Mr Dekraai was mentally unstable and had threatened at least once to kill himself or someone else.

Court documents show that Mr Dekraai complained about repeated phone calls from his ex-wife, reports say. Contact between them was limited to one call a week.

The custody dispute was still continuing the day before the shooting, when Ms Fournier and Mr Dekraai appeared for a routine hearing.

Ms Fournier's friend Sharyn White told AP that weeks before her friend said her ex-husband had stopped by Salon Meritage and threatened to kill her and others there.