Cal. Elec. Code § 16703
If in any election contest it appears that another person than the defendant has the highest number of legal votes, the court shall declare that person elected.