BOSTON, Mass. (WWLP)– A long-debated proposal to expand driver’s license access to undocumented immigrants took a major step Thursday toward becoming law, clearing the Senate with a strong enough margin to overcome the prospect of Gov. Charlie Baker’s formal opposition.

Senators voted 32-8 in favor of the controversial reform, which has drawn skepticism from Baker and split voters. Five Democrats joined the chamber’s three Republicans in dissent, but backers still got more than enough favorable votes on record to signal the Senate would clear the two-thirds vote needed to override a potential veto. The House passed a similar bill by a veto-proof 120-36 margin in February.

Pitching the bill as a road safety and immigration measure, supporters said it would ensure that some of the 185,000 immigrants who already live in Massachusetts without legal status are properly tested before driving and relieve their fears of traffic stops spiraling into devastating consequences.

“Allowing parents to drive their kids to school, take them to doctor’s appointments or be in charge of carpooling to take their kids to soccer, all without the concern they may be separated if they are pulled over, will allow children of undocumented immigrants to breath and have a sigh of relief,” said Sen. Adam Gomez, a Springfield Democrat and one of the bill’s main sponsors.

Democrat Sens. Nick Collins of Boston, Anne Gobi of Spencer, Marc Pacheco of Taunton, Walter Timilty of Milton and John Velis of Westfield voted against the bill, as did all three Republican senators – Bruce Tarr of Gloucester, Ryan Fattman of Sutton and Patrick O’Connor of Weymouth.

When Sen. William Brownsberger read out the final result, attendees in the Senate gallery erupted into applause and cheers — some shouting “thank you” — loud enough to prompt Brownsberger to bang the gavel and ask them to quiet down. “Sorry, we can’t have this,” Brownsberger told the crowd. “We can’t have this in here. Thank you for your support, but we can’t have this in here.”

Legislators have several more steps to complete before the bill can become state law. House and Senate leaders will need to agree on final language to send to Baker’s desk, which they could try to do informally — senators previously said the changes they made before bringing the proposal to the floor were technical in nature — or by appointing a conference committee. The House approved its version of the license access bill in February with a 120-36 vote, well above the number of representatives in support that would be needed to override a veto.

Existing state law prohibits anyone “who does not have lawful presence in the United States” from acquiring either a standard Massachusetts or expanded REAL ID-compliant driver’s license. The bill would open up access to the former license type, which cannot be used to board a flight or access a federal building, regardless of immigration status. To apply for a license, someone without legal presence would need to provide the Registry of Motor Vehicles with a foreign passport or a consular identification document as well as at least one of five other documents: a driver’s license from another state, a foreign driver’s license, a birth certificate, a foreign national ID card, or a marriage certificate from any U.S. territory.

Over the course of Thursday’s debate, senators beat back attempts by Republicans and a handful of Democrats to distinguish the licenses that could be awarded to undocumented immigrants, either by offering them entirely separate “driver privilege cards” or by requiring a standard Massachusetts license issued to an immigrant without legal status to be printed in a different color or declare that it is not eligible as a form of identification.

“I am one of those who comes to the chamber concerned about some of the provisions before us, concerned because a driver’s license is one of the most, if not the most, recognizable, important pieces of identification in our society, bar none,” Tarr, the chamber’s minority leader, said at the start of the session.

“Trying to ensure our driver’s licenses have integrity and cannot be misused for various purposes — those are important things, and those things don’t go away because of the hardships we’ve heard about,” Tarr added.

Bill sponsor Sen. Brendan Crighton, a Lynn Democrat, contended that bifurcating licenses awarded to immigrants without legal status and all other licenses could have a “chilling effect” on the bill’s goal to get more drivers road tested. “We believe that could lead to stigma, open up opportunities to discriminate,” Crighton said. “It is unnecessary because we are just focused on the ability of someone to drive.”

One amendment, offered by Fattman, would have required the RMV to transmit licensing information to any city or town clerk seeking to verify the identity of someone using a license to register to vote. Fattman said local elections officials in his district had contacted him expressing concerns about the topic, and bill backers fired back that the state already has protections in place to prevent ineligible residents from registering to vote. Gomez called concerns that the bill would unleash voter fraud a “red herring.”

Senators voted 10-29 to reject Fattman’s amendment.

House Republicans unsuccessfully pushed a similar amendment during their debate on the bill, which Baker described as a “perfectly reasonable way to deal with this.”

“Green card holders are required to explicitly demonstrate lawful presence, OK? We’re talking about a situation now where, under the current statute as I understand it, all the rules associated with determining lawful presence are going to go away. That’s a problem,” Baker said Thursday morning. “It basically means, in some respects, the Registry is going to be flying blind with respect to what it issues when it issues these licenses. And it puts tremendous pressure on cities and towns to do the cleanup on the back end.”

Sixteen other states already have laws on the books allowing undocumented immigrants to acquire licenses, Crighton told his colleagues. Sen. Sonia Chang-Díaz, a Boston Democrat, added that in many of them, the rate of uninsured drivers and hit-and-run crashes dropped after implementation of the policy. “This bill means trust and dignity for immigrants in our state who lack federal status,” Chang-Díaz said. “Without a license, a routine traffic stop can have a lasting and traumatic set of repercussions: arrest, ICE detention, deportation. It can tear families apart, and that is a heavy, heavy burden to carry that fear through the daily activities of one’s life.”

While the legislation has now cleared both chambers with more than three-quarters of elected lawmakers in support, Bay Staters in general are nearly evenly split on the idea of allowing people without legal immigration status to acquire Massachusetts licenses, according to a new poll.

A Suffolk University-Boston Globe poll of 800 Massachusetts residents published Monday found 46.6 percent oppose the proposal, 46.1 percent support it and nearly 7 percent are undecided. The poll was conducted from April 24 to April 28 and has a margin of error of 3.5 percentage points.

Road safety and immigration reform advocates spent years unsuccessfully pressing lawmakers to act, arguing that expanding license access would ensure undocumented immigrants who already live in Massachusetts are properly tested before getting on the road and rein in their fears of law enforcement entanglement.

The Driving Families Forward coalition, which includes a range of civil rights, immigration reform and organized labor groups, praised the Senate’s vote and called for Baker to sign the legislation, arguing it “provides all the safeguards necessary to answer any doubts he may has (sic) raised previously.”

“We are once again overcome with happiness, pride and gratitude for today’s historic vote in the Massachusetts Senate,” 32BJ SEIU Vice President Roxana Rivera and Brazilian Worker Center Executive Director Lenita Reason, who together lead the coalition, said in a joint statement. “The legislature has now resoundingly supported the Work and Family Mobility Act, moving all state residents toward greater road safety, improved security, better public health and a more vibrant economy, and promising a profound transformation in the lives of undocumented immigrants across the Commonwealth.”