SAN JOSE — Hundreds of firearms were taken off the streets and put into the hands of law enforcement Saturday in the most successful gun buyback event ever sponsored by the San Jose Police Department and other Santa Clara County agencies.

Dozens of cars snaked around the SJPD’s substation on Great Oaks Parkway as residents anonymously handed over unwanted firearms in exchange for Target gift cards with no questions asked. Those who turned in handguns, rifles and shotguns were given $100 cards, while individuals who handed in assault-style weapons were given $200 cards.

But an hour and a half into the five-hour event, organizers ran out of the $20,000 they had in Target gift cards and were handing out cash instead. Police said the first person in line turned in 45 handguns. Police said they collected 690 weapons, breaking the old record of 450.

Authorities hoped to attract city and county residents who owned guns they no longer used or maintained. The event held particular significance this year as the

Authorities hoped to attract city and county residents who owned guns they no longer used or maintained. The event held particular significance this year as the nation’s 10th largest city struggles with an uptick in homicides.

San Jose has had 45 homicides so far this year and as of Saturday was one homicide away from matching the city’s 20-year high in 2012. Last year, the city had 30 homicides.

Johnny Gogo, a community-focused prosecutor for the Santa Clara County District Attorney’s Office, said it’s difficult to tie buyback events to a decrease in homicides or other crimes. “But when you see the line of cars that we have and you see the number of people turning in their firearms, …you can’t help but think that that’s going to have an impact on these issues, from violence against our police officers to stolen firearms from residential burglaries,” he said.

“These gun buyback events do not solve our issues of gun violence, but it’s a small effort to try to help those issues,” added Gogo, who has helped organize previous buybacks.

Gogo credited the event’s success to extensive community and social media outreach and pleasant weather, along with timing. The department’s previous gun buyback was held 18 months ago.

Residents transported their unloaded firearms in the trunks of their cars and were asked to remain in their vehicles. Volunteers gave individuals a gun lock and information on gun safety. Another group of volunteers and police officers counted and logged the weapons.

Firearms found to be stolen will be returned to their owners. The rest will be destroyed.

Sergio Jimenez, the new councilman for District 2, said he was surprised to see the long line of cars.

“That’s the importance — to make sure that we take as many guns as possible out of the streets and out of the homes of people who just don’t use them,” he said.

The gift cards were paid for by asset-forfeiture funds from the District Attorney’s Office and the San Jose Police Department, as well as donations collected by the San Jose Police Foundation.

Event sponsors included the offices of newly elected Assemblyman Ash Kalra, Santa Clara County Supervisor Mike Wasserman and Assemblyman Mark Stone, as well as First 5 Santa Clara County and The Health Trust.