The state Senate joined the House Thursday in overriding a veto by Gov. Charlie Baker and authorizing driver’s licenses for undocumented immigrants. The final vote in the Senate was 32–8 to approve the bill over Baker's objection.

The new law will allow immigrants without legal status to apply for a standard state driver’s license beginning July 1, 2023. It prohibits the Registry of Motor Vehicles from asking about or keeping documents related to immigration status.

“This is a well-vetted piece of legislation. We've gained support from a wide range of stakeholders over the course of a number of years,” said lead sponsor Sen. Brendan Crighton ahead of the vote on Thursday. “Our lives are safer when every single driver has to pass a road test, a vision test, and obtain insurance.”

Proponents said the measure will improve road safety and assuage immigrants’ worries of being revealed as undocumented and face deportation because of a routine traffic stop or accident. As of 2016, there are about 250,000 undocumented immigrants in Massachusetts, according to a report from the American Immigration Council.

The original version of the bill was introduced almost 20 years ago, and multiple iterations have cropped up and failed, including one from then-state Rep. Marty Walsh in 2007, who is now the U.S. Secretary of Labor.

The measure is about being safe on the road, according to Elizabeth Sweet, executive director of the Massachusetts Immigrant and Refugee Advocacy Coalition.

“By making all immigrants eligible for a driver's license, we make it possible for all drivers to drive in a safe, secure manner,” she said.

“We know in other states that have passed this bill, passed a form of driver's licenses for immigrants, that hit-and-run accidents go down by 10 percent,” House co-sponsor Tricia Farley-Bouvier told GBH News on Thursday morning.

After implementing a similar law, Connecticut saw a reduction of hit-and run crashes, and a decline in the number of people found guilty of unlicensed driving, an investigation by the GBH News Center for Investigative Reporting found. By 2019, 50,000 undocumented immigrants had taken written exams, vision tests, and road tests to get drivers licenses.

Sen. Adam Gomez told members of the Senate that the bill would give undocumented members of the community the same flexibility and options everyone else has in driving.

“The ability to drive our car to the store, to the doctor's appointments and to take our kids to sports practices, or even getting involved with extracurricular activities while granting them a peace of mind that they should that,” said Gomez, a Senate co-sponsor.

The bill is now backed by the Massachusetts Major City Chiefs of Police and most Massachusetts sheriffs and district attorneys.

“We sat down with the chiefs and asked what their concerns were and worked with them. We did change some of the bill and made sure that we're really clear on the types of documents people need to provide to get licenses,” said Rep. Christine Barber, lead co-sponsor of the House bill. “We also worked closely with the district attorneys who have seen these cases and seen people who are only going to court because they can’t get a license.”

To apply for a driver’s license, immigrants will have to show two documents proving their date of birth and identity, like an unexpired foreign passport, consular identification document or certified copy of a birth certificate.

The state House and Senate both overwhelmingly approved the bill earlier this year, but Baker vetoed it on May 27. The governor said at the time that the legislation would create problems for the Registry of Motor Vehicles, which he said lacks the expertise to verify the types of identification immigrants use from other countries, a requirement of the bill. He also said the bill “restricts the registry’s ability to share citizenship information with those entities responsible for ensuring only citizens register for and vote in our election.”

Secretary of State William Galvin has publicly refuted that claim.

On Thursday, Crighton said, “On the issue of voting, we’ve debunked it again and again, and again.”

The House voted 119–36 on Wednesday to override the veto.

Advocates have long said undocumented immigrants would still be tested before driving, and go through qualifications a citizen driver would have to go through — something opponents have pointed out as a concern in the past.

Senate Minority Leader Bruce Tarr rose in opposition to the bill, calling it “very, very problematic” and citing concerns over voter registration. He said his amendments were rejected in a “rush to move this bill forward.” He said one of those addressed the design of the licenses which aren’t going to look any different from current licenses, and could cause problems with voter registration.

Crighton noted in his speech that the law will require the Secretary of State to keep tabs on the voter registration process to be sure nothing goes amiss.

A Boston Globe-Suffolk University poll of 800 Massachusetts residents published in the spring showed residents were divided on the issue. Forty-seven percent said they opposed the driver’s license bill, and 46 percent supported it, with 7 percent unsure.

Democratic gubernatorial hopefuls Attorney General Maura Healey and state Sen. Sonia Chang-Díaz both voiced their support of the veto override on Twitter. Republican candidate Geoff Diehl said he would support a ballot question to repeal the legislation, according to statement from his campaign.