Many Bay Area cities ended 2013 with their lowest number of homicides in years or even decades, mirroring a national trend in fewer slayings.

San Francisco, Oakland, Richmond and San Jose saw fewer killings last year, and authorities attributed the homicide reduction to a combination of factors, including aggressive local, state and federal task forces; changes in demographics; and the use of video to solve cases. But they warned that the apparent crime lull will not last without continued diligence on the part of law enforcement officials and the public.

"We cannot do this alone, said Officer Albie Esparza, a San Francisco police spokesman. "With help from the community, we are able to solve crimes, including when witnesses come forward. Also, when there is video surveillance, it without a doubt helps police in solving crimes and/or identifying suspects and being able to make arrests."

For now, the statistics appear promising.

San Francisco, population 825,000, had 48 homicides last year, down from 69 in 2012.

Oakland, population 400,000, had 92 killings, compared with 131 in 2012. The 2013 tally is the lowest since 2004 and included several high-profile slayings that drew nationwide attention, including the shooting death of a neighborhood dog walker and the killing of an 8-year-old girl at a sleepover party.

In Richmond, population 106,000, police investigated 16 slayings, a low not seen in 33 years.

But San Jose, population 982,000, had 44 homicides, down from 46 in 2012 but still the third straight year the city has since more than 40 slayings in a year. "The good news substantially outweighs the bad news," said Franklin Zimring, a professor at UC Berkeley School of Law who studies crime trends. "But now we come to the puzzling part of the program: What is an explanation for these trends? And the answer is that it's not at all clear. Since there's no general pattern, there's also no general explanation."

Killings fall nationally

The Bay Area drop in homicides is mirrored across the nation.

In 2013, New York City recorded 333 homicides, a 20 percent drop from the year before. In Los Angeles, police reported 250 homicides, a 16 percent drop and the lowest since 1966. Chicago had 415 homicides, down from more than 500 in 2012, when it led the nation as the city with the highest number of killings.

Oakland police focused their attention on going after members of two gangs that were responsible for shootings, home-invasion robberies and assaults. "I can't say we've eliminated those two groups, but I believe we've severely impacted their ability to operate, and I think that's what's given rise to the reductions you see," said interim Police Chief Sean Whent.

The grassroots approach is also evident in community policing programs, where officers walk their beats and get to know the merchants and residents they serve. Last year, Oakland reorganized its police force, designating five policing areas, each commanded by a police captain.

Effects of layoffs

Officers in San Jose and Oakland have been laid off or left for other departments in recent years because of budget problems, and that has affected morale and crime-fighting, union leaders in those cities say.

"I think Oakland and San Jose are offering interesting comparisons," said Robert Weisberg, a criminal justice expert at the Stanford Law School. "Oakland was and still is one of the most dangerous cities in the country. It's right near the top for homicide rates, that is to say, homicides by population. The fact that it went down a little is obviously good news, but I think it's more significant that it remains catastrophically high."

San Jose, by contrast, "is still one of the safest cities in the U.S."

Authorities also cite gun suppression and domestic violence programs - federal prosecutors focused on suspects who carried guns near schools in Oakland and San Francisco - as well as the efforts of emergency-room personnel for saving lives.

Henry K. Lee is a San Francisco Chronicle staff writer. E-mail: hlee@sfchronicle.com Twitter: @henryklee