The election count for mayor of the nation's seventh-largest city ended Friday with incumbent Dick Murphy (search) leading by 2,205 votes, but a court challenge could keep alive the write-in candidacy of a maverick city councilwoman and surf-shop owner.

A Superior Court judge will be asked Monday to consider whether to count ballots on which voters wrote Councilwoman Donna Frye's (search) name but failed to fill in an adjoining bubble. The county registrar of voters has said California's election code prohibits tallying such ballots.

Seventeen days after the election, Murphy had 157,459 votes to 155,254 write-ins verified for Frye, according to the registrar. Ron Roberts, a San Diego County supervisor, had 141,505 votes.

Murphy declared victory Friday night before cheering supporters. He said he doubted legal action would change the results, and added, "Even if the courts got involved and ruled the other way, we won the mayoral election."

The lawsuit filed Wednesday by the League of Women Voters (search) of San Diego asks that all ballots be counted. The suit said "thousands" of voters wrote Frye's name but neglected to fill the optical-scan bubble.

Voter Registrar Sally McPherson said Friday she did not know how many ballots had a blank bubble with Frye's name written in.

The campaign was a dreary rematch of a 2000 contest between Murphy and Roberts, both Republicans, until Democrat Frye jumped in less than five weeks before the Nov. 2 election.

Frye, 52, promised to breathe some "aloha spirit" into City Hall and end a culture of backroom deals as the seaside city of 1.3 million people plunged into one of its worst financial scandals ever.

Voter disgust helped Frye, who was the lone dissenter in a 2002 City Council vote to enhance retirement benefits for city employees. That vote — one that Murphy, 61, later said he regretted — further weakened the city's underfunded pension plan and drew sharp criticism in a city-commissioned investigation into whether the city hid bad news about its finances.

The U.S. Securities and Exchange Commission and Justice Department are investigating the city's financial practices.