BOSTON — State Secretary William Galvin is proposing legislation that would let Massachusetts voters register and vote on Election Day beginning in 2019.

Under current law, Massachusetts voters must be registered at least 20 days before an election.

Galvin’s bill would let voters who missed that 20-day deadline go to their local polling place on Election Day, complete a voter registration form, and vote immediately.

A Suffolk Superior Court judge last year ruled that the 20-day cutoff violates the state constitution.

The judge noted that the state’s adoption of early voting in 2016 allowed voters to begin casting ballots on Oct. 24, just five days after the Oct. 19 registration cutoff.

Galvin is up for re-election this year and is facing a Democratic primary challenge from Boston City Councilor Josh Zakim.