Massachusetts on Thursday became the 14th state in the country to adopt an automatic voter registration system, according to Secretary of State William Galvin and advocates who backed the measure.

Galvin announced that Gov. Charlie Baker signed into law a bill that would automatically register eligible voters when they interact with the Registry of Motor Vehicles and MassHealth, unless they opt out.

Galvin said he was "excited to begin preparations today" and expected to have the necessary systems in place on Jan. 1, 2020, "just in time for the next Presidential Primaries."

Janet Domenitz, the executive director of MASSPIRG, said supporters had pushed for automatic voter registration for almost six years.

"This is a home run for democracy. The push for this law has gone many innings, but now we all win," she said.

Pam Wilmot of Common Cause Massachusetts said the legislation, based on bills originally filed by state Sen. Cynthia Creem, of Newton, and the late state Rep. Peter Kocot, of Northampton, is among the strongest in the country and "will make our voter registrations system more efficient, accurate, and secure while at the same time improving voter participation."

Backers of the bills and Galvin distributed their own press releases touting the signing before Baker's office publicly disclosed how he acted on any of the several bills on his desk with Thursday deadlines for action.