SAN JOSE — The contentious drive to overturn San Jose’s ban on Styrofoam containers has failed after elections officials found more than half the signatures gathered to place the issue before voters were bogus — and many were just made up.

Local restaurant owners had collected 38,784 signatures in hope of putting a measure on the June ballot to repeal the ban, which took effect for large chains last week and will hit smaller shops at the start of 2015. San Jose became the largest city in the country to prevent shops from using the clamshell food containers, which are seen as damaging to the environment but are often the cheapest option for business owners.

But in the past few months, council members and the city clerk’s office have fielded scores of complaints from residents who said they were approached outside grocery stores and asked to sign a petition they were told would ban the polystyrene containers. The restaurant owners’ petition would actually do just the opposite — overturn the ban — but they titled their measure the “San Jose Residential Curbside Zero Waste Recycling Initiative.”

City officials also heard from homeless people who said the initiative’s backers gave them gift cards, which turned out to have no money on them, in exchange for gathering signatures. Others hired to collect signatures lodged complaints with City Hall that they were told to make up names if they couldn’t gather enough real ones.

Because of the grievances, the Santa Clara County Registrar of Voters spent the last month exhaustively checking every last signature, instead of a smaller sample size review that is typical. They found that 17,738 signatures were legitimate, short of the 21,046 needed to make the ballot.

“It certainly lifts the cloud of uncertainty, which is important for many small businesses,” said Councilman Sam Liccardo, who pushed the initiative passed by the City Council in August.

Courts typically allow measures to reach the ballot even when signature gatherers lie about their measure, but there were plenty of other problems found with the names submitted by the polystyrene supporters in November.

Of the roughly 21,000 invalid signatures, nearly 15,000 were linked to names of people who didn’t appear to exist, acting registrar Shannon Bushey said. Another 1,346 names were written so unintelligibly that officials ruled them gibberish, she said.

What’s more, another 1,051 people signed twice, and other people who signed didn’t live in San Jose or were registered to vote under a different address than they listed.

All of the signatures are now thrown out, and the proponents of overturning the ban would have to start over, City Clerk Toni Taber said.

The two San Jose restaurant owners who signed the petition, Jade Vo and Nestor Zubizarreta, did not return calls seeking comment. The California Restaurant Association, the main group that initially opposed the ban, said it was not spearheading the signature gathering.

The Santa Clara County District Attorney’s Office said it received one formal complaint linked to the signature gathering but did not find enough evidence for a criminal case.

Some shop owners say the ban will drive up costs since alternative to-go containers and cups can be two or three times more expensive than Styrofoam, and they dispute assertions that polystyrene is not recyclable.

Liccardo countered that some businesses are reducing costs by using recyclable containers that allow shops to use smaller trash bins, which come with a lower garbage bill, and he asserted that bits of Styrofoam stay in local creeks for years.

Allison Chan, the clean bay campaign manager for the Save the Bay environmental group, said at least 31 other cities have already banned Styrofoam, and this was the first time a group organized an attempt to put the issue on the ballot.

“It was a huge concern,” said Chan. “We’re very relieved. We hope this means the other cities that were interested in moving forward (with Styrofoam bans) will do so.”

Contact Mike Rosenberg at 408-920-5705. Follow him at Twitter.com/RosenbergMerc.