Photo: Jae C. Hong / Associated Press 2018

SACRAMENTO — California has struggled to enforce a unique state law that allows officials to seize guns from people with criminal convictions or mental health problems, leaving firearms in the hands of thousands of people legally barred from owning them.

Legislators first took notice of the problem in 2013, after the gun massacre of 20 children and six adults at a Connecticut elementary school, and set aside $24 million to reinvigorate the firearms-seizure program. A representative for then-Attorney General Kamala Harris said eliminating a backlog that had grown to nearly 20,000 people was her “top priority” and estimated it could be done in three years.

Six years later, the state has been able to cut the list only in half. As of July, the backlog of people whose guns should be confiscated totaled about 9,000.

Justice Department officials note that they have reduced the size of the backlog each year since 2013, even as new offenses prohibiting gun ownership and surging firearms sales land more people on the list.

Attorney General Xavier Becerra called it “a phenomenally successful program, in terms of not only recouping weapons, but also never having an incident where anyone’s been hurt” during a gun seizure.

Photo: Rich Pedroncelli / Associated Press 2018

But the slow progress highlights the challenge of enforcing California’s tough firearms restrictions. In his January budget plan, Gov. Gavin Newsom — who has promised to “raise the bar” on gun control — proposed another multimillion-dollar funding increase to hire more special agents and support staff to cut the backlog.

“This is just the unglamorous continual need to invest in the task and to see it through,” said former state Sen. Mark Leno, D-San Francisco, who carried the 2013 funding measure. “It just does not go away, and the job is never done.”

The state’s Armed and Prohibited Persons System is a database, unlike any other in the country, that checks gun sales against records of criminal convictions, mental health holds and domestic violence restraining orders to flag prohibited owners who have not relinquished their weapons. Field teams of Justice Department special agents go to subjects’ homes to seize their guns and ammunition.

The program is meant to serve as a backstop to the universal background checks that California adopted in 1991. It alerts authorities to people who became ineligible to possess firearms after legally acquiring them. Former state Sen. Jim Brulte, a Riverside Republican who wrote the 2001 bill that created the program, said it remains among his proudest legislative accomplishments.

“We got all of the players who care about this issue to the table,” Brulte said, including the National Rifle Association and what is now called the Brady Campaign to Prevent Gun Violence. “We had a lot of people who said it couldn’t be done.”

The database was completed in 2006, and enforcement began in April 2007. But the list kept growing as names were added faster than the Justice Department’s Bureau of Firearms, hit hard by cuts during the recession, could track people down and take their guns.

The 2013 cash infusion paid for four dozen temporary positions, supplementing the 42 special agents the Justice Department already had. But retirements and transfers held the total number of agents to 57, and the department ultimately had to return $6 million of the $24 million increase. An additional $5 million appropriation in 2016, to contract with local law enforcement agencies to reduce the backlog, went unspent.

A spokesman for Harris, who was elected to the U.S. Senate in 2016 and is now running for president, said she was “a leader in getting guns out of the hands of those who shouldn’t have them.” The backlog of prohibited people was reduced to about 10,600 when she was attorney general, from more than 21,000 at its peak.

Under Becerra, her successor, the Justice Department’s hiring problems have persisted — seven positions authorized for the program went unfilled last year. The department has made agents sign agreements to stay on the job for at least two years and required that they work overtime to get the backlog under control.

Alfredo Cardwood, president of the Justice Department agents union, said recent pension changes for new hires have made the agency less attractive for recruits who can find jobs with local law enforcement.

“We get people straight out of college, with minimal law enforcement experience, and we have to train them for a year,” Cardwood said. “After we train them, they skip out and go work for the local D.A.s.”

The starting salary for a special agent with the Justice Department is $50,844 to $66,852, though agents can eventually make up to $101,000. A recent report by the California Department of Human Resources found that in 2017, state detectives and criminal investigators, a category that includes special agents, made about 19 percent less than their local government counterparts.

Cardwood said agents are working 30 hours of overtime per month to keep up with the pace of prohibited people being added to the gun-seizure database.

“We just don’t have enough manpower to put it out,” he said.

Becerra said the department’s enforcement efforts were hamstrung by having to offer temporary employment to prospective agents for several years. About two dozen of those positions were made permanent in 2016.

“It’s hard to hire people to go out there and retrieve weapons, do a very dangerous job, if you tell them we’re only going to hire them for a year of work,” Becerra said.

“California is a big state,” he added. “When you have only a few teams to cover the entire state, it’s impossible to go after thousands of people who have fallen onto the list.”

That has not satisfied the state Senate Republican Caucus, which requested an oversight hearing last spring to dig into what it said was a “troubling” drop in the number of investigations that the Justice Department completed. Even accounting for almost 3,500 people removed from the database because they died or their gun prohibitions expired, the backlog decreased by just 408 names in 2017.

State Sen. Jim Nielsen, a Gerber (Tehama County) Republican and vice chair of the budget committee, said the explanation about difficulty recruiting special agents “was just a hail Mary, lame excuse if I’ve ever heard one.”

He blamed a “lack of will” by the Justice Department.

Although Republicans didn’t get their hearing, several senators met with Becerra. Nielsen said the attorney general promised to provide a breakdown of how money for the program had been spent and a proposal for clearing the backlog. Nearly a year later, he said, they have yet to hear back.

“The more money we give them, the slower they go,” Nielsen said. “Before we proceed with more money, we need a clear plan.”

Craig DeLuz of the Firearms Policy Coalition, a gun rights organization, says the state should send a warning letter to everyone in the database. He believes many people are on the list erroneously, while others would voluntarily hand over their guns to a dealer or someone who is not prohibited if asked.

Special agents give no advance notice of their operations so as not to tip off people who might try to hide their guns, according to the Justice Department.

Proposition 63, which voters approved in November 2016, is supposed to help with the backlog by requiring that anyone convicted of a crime leading to a gun prohibition give up weapons through the court process before the case can be closed. That provision took effect last year.

Newsom, who sponsored the initiative, called it “a mitigation strategy to reduce the increase of that backlog going forward.” His spending plan for next fiscal year includes a $5.3 million increase for the gun-confiscation program.

Becerra said the money would allow his department to “do two things differently”: hire more permanent agents and expand its gun seizure teams across the state. He declined to say how quickly they could clear the backlog with the additional resources.

“If it’s a real commitment, we’ll tackle it,” Becerra said.

Even with the program’s struggles, advocates for reducing gun violence argue, it is worthwhile.

“We have to make sure those guns are recovered,” said Amanda Wilcox, legislative chairwoman of the California chapters of the Brady Campaign. “We don’t know which one of those is going to be the future mass shooter. It’s hard to prove what you’ve prevented.”

Alexei Koseff is a San Francisco Chronicle staff writer. Email: alexei.koseff@sfchronicle.com Twitter: @akoseff