As City Hall hand tallies ballots, city attorneys are heading to court to seek refunds for defective products.

San Francisco has notified the manufacturer of its electronic voting systems that it will go to court to seek a multi-million dollar refund unless the company replaces hundreds of defective machines and reimburses the city for costs related to Tuesday's election.

The pending legal action comes as city officials are hand-counting paper ballots from this week's local election and do not expect to have final vote counts until Thanksgiving. Meanwhile, the City Attorney has notified the manufacturer of the faulty machines of its intent to sue, the first step in seeking refunds under its contract with the Nebraska-based firm, Election Systems and Software.

"If the machines were working properly, they wouldn't be counting ballots," said Ann O'Leary, Deputy City Attorney. "They have been in breach of contract since August."

An ES&S spokesman said in a written statement that the company has fulfilled its obligations to the city -- all but setting the stage for upcoming litigation.

Across the country, a handful of municipalities -- some large and some small - are still sorting out problems associated with electronic voting systems. However, it appears San Francisco is the first jurisdiction that has said it will sue following Tuesday's vote.

"Local governments should look at these kinds of cases," said John Bonifaz, legal director of Voter Action, a public-interest law firm that supports suing voting machine makers for delivering defective products. "This is probably going to be one of a number of breach of contract lawsuits that are brought."

San Francisco's dispute with ES&S dates back to this summer, when California Secretary of State Debra Bowen decertified the optical-scan voting machine model used by the city because it failed to read some pen marks made by voters on paper ballots. In September, Bowen issued a directive saying ES&S should fix the machines and pay the city for the costs of doing so. In October, ES&S replied there was nothing wrong with its machines and refused to do so. That prompted San Francisco to borrow other optical scan voting machines from nearby counties, which were used Tuesday. That option will not exist during February's presidential primary.

City election officials brought all of Tuesday's ballots to City Hall to be counted by a special high-speed scanner. However, to ensure the accuracy of the count, 10 percent of all regular ballots and 25 percent of absentee ballots are being counted by hand. City officials hope to finish the counting by Thanksgiving.

San Francisco's O'Leary said the current vote-counting scenario would not work for California's presidential primary.

"We need to resolve this for the presidential primary," she said. "We sent a notice of default letter, which is required under the contract. We gave them to November 19 to respond. If they haven't complied, we will take legal action."

The city wants ES&S to cover all the costs of certifying the $3.5 million worth of machines purchased by the city, to pay for $300,000 in costs associated with borrowing 600 machines from nearby counties for Tuesday's election, and to permanently replace any uncertified machines before the 2008 elections.

Voting industry watchers say the electronic voting machine problems in San Francisco and elsewhere do not bode well for smooth elections in 2008, which will be much more crowded and high-pressure than this Tuesday's lower-turnout local races.

"It does call into question the technology," said Warren Stewart, senior project director for VerifiedVoting.org. "The answer last year was 'There will be new machines' and 'We didn't have the poll worker training.' That suggested the problems would go away."