SANTA ANA, California (Reuters) - A former tugboat worker pleaded guilty in a California courtroom on Friday to eight counts of first-degree murder in a 2011 mass shooting at a hair salon that killed his ex-wife and seven other people.

Scott Dekraai, who prosecutors say had been locked in a custody battle with his ex-wife, could still face the death penalty for committing the Seal Beach rampage, which ranks as the worst mass killing in Orange County's history. His guilty plea in the crime came weeks ahead of the scheduled start of his trial.

(Reporting by Dana Feldman; Editing by Cynthia Johnston)