SACRAMENTO — More than 800,000 people have received California driver’s licenses in the past two years under a 2-year-old law that allows people living in the country without documentation to legally drive in the state.

But some state lawmakers are worried that immigrants will become leery of revealing their legal status to a government agency once President-elect Donald Trump takes the oath of office. State lawmakers are working on bills for the 2017 legislative session to ensure that information submitted by immigrants who have no documentation is safeguarded should the Trump administration adopt aggressive deportation policies.

Data from the Department of Motor Vehicles show that the number of special licenses that have been granted has declined this year from last.

“It remains to be seen whether the Trump administration deters other immigrants from applying next year, as the fear is very real,” said former Assemblyman Luis Alejo, a Democrat from Salinas who authored the bill. “But, we are doing everything possible to ensure that AB60 remains a success story in our state.”

On the first day licenses were offered on Jan. 2, 2015, to immigrants without documentation, thousands of people formed long lines at motor vehicle offices across the state. Some showed up as early as 3 a.m. to stand in line, saying the licenses would allow them to drive to work and drive with their families without fear.

Within the first six months, nearly 400,000 people had been granted licenses in the state under AB60. While approximately 50,000 people on average each month were granted licenses in 2015 under the law, this year that number dropped to 18,000 on average each month.

The numbers for 2016 showed a gradual decline in the number of licenses approved by the state, with no changes between September and November, when Trump won the presidency. Figures for December will be released in January.

“The law has proven to be a huge success story for helping immigrants, and for California,” Alejo said. “It’s helping to improve people’s lives, and the number of people who are tested and insured on our roads has only increased.”

California Department of Motor Vehicles officials said the agency “takes very seriously the protection of personal information for all license holders.” Law enforcement agencies, including U.S. Immigrations and Customs Enforcement, can obtain general driver’s license information like addresses, birth dates and driving records. But the data-sharing systems do not contain information on a person’s legal status, motor vehicle officials said in a statement.

State law says information collected by the DMV regarding the legal status of an applicant is not public record and can’t be disclosed by the department, unless required by law.

Julia Harumi Mass, a senior staff attorney for the American Civil Liberties Union of Northern California, said AB60 has strong privacy protections, but she added that it’s important for immigrant-rights groups and lawmakers to take another look at the law to ensure the protections are strong enough.

State Senate President Pro Tem Kevin de León, D-Los Angeles, introduced a bill this month that would ban state and local law enforcement officials from helping federal Immigration and Customs Enforcement agents with deportation cases. SB54 would also have state and local agencies review their privacy polices to ensure that information like immigration status kept by the DMV is not shared with immigration enforcement officials.

“The President-elect has generated much fear and uncertainty with his threats of mass-deportations,” de León said in a statement. “In response, the Legislature is seeking to protect the due-process rights and privacy of California’s undocumented community.”

Melody Gutierrez is a San Francisco Chronicle staff writer. Email: mgutierrez@sfchronicle.com Twitter: @MelodyGutierrez