BOSTON — Anyone who lost their license because they were convicted of a drug crime in Massachusetts can now get their license back.

Gov. Charlie Baker signed a law on Wednesday repealing the automatic license suspension of anyone convicted of a drug crime and the fine that goes along with it. The repeal is effective immediately.

“One of the big problems we face in criminal justice is reentry, the ability for people who made a mistake, who paid their dues, to find their way back into a productive life with purpose,” Baker said. “The lack of a driver’s license, it should be obvious to everybody, is a huge impediment to somebody’s ability to find work and find purpose.”

State Rep. Carlos Gonzalez, D-Springfield, called the law one of the most important bills he has voted on in his first year in the Legislature. “It’s going to help so many people try to reinvent their lives, to regenerate their thoughts and actually make something successful for themselves,” Gonzalez said.

The automatic license suspension was established in 1989 as part of the national War on Drugs. Under that law, anyone convicted of a drug-related crime, whether or not it related to a motor vehicle, had his license suspended for up to five years. The offender had to pay a license reinstatement fine of at least $500.

The new law eliminates the license suspension for most drug crimes, including the possession and sale of drugs. It keeps a five-year license suspension in place for anyone convicted of trafficking in cocaine, fentanyl, heroin or other opiates, although someone convicted of these offenses can apply for a hardship license. The law repeals the license reinstatement fine.

Records of suspensions will be shielded from public access, beginning 60 days from now.

A judge can still suspend someone’s license for a crime related to driving.

They did the crime, they paid their time and now they are going to rejoin society.”

Similar bills were introduced for the past three legislative sessions, but they never made it through the Legislature. This time, the bills had support from Attorney General Maura Healey and several sheriffs and district attorneys, in addition to a coalition of labor, religious groups and liberal organizing groups calling itself Jobs Not Jails. Support in the House and the Senate was bipartisan, and the final bill passed both bodies unanimously.

Advocates for the bill said removing the automatic license suspension will allow former prisoners to more easily reintegrate into society by getting a job and supporting their families.

Jafet Robles, a single father and organizer for Neighbor to Neighbor, a Springfield organizing group, had his license suspended for a drug crime. “I faced a lot of barriers upon my release,” Robles said.

Robles said the new law will knock down one of the barriers people face. “We don’t want drugs in our community, but when someone finishes their time, we feel it does the state better when we allow him to get his license and reintegrate back into society,” Robles said. “When people don’t get their license and they have nothing to live for, they’re more likely to result in a life of crime.”

Olga Pendraza, a leader in Neighbor to Neighbor, said the law will allow her to take a job that otherwise would require a two-hour bus commute at night. “This victory brings us one key step closer to liberation from a system that perpetuates injustice,” Pendraza said.

Cassandra Bensahih, director of Ex-prisoners and Prisoners Organizing for Community Advancement in Worcester, called the law “a real life changer” that “will promote job security and dignity to those of us who have already paid for their mistakes.”

Advocates and numerous lawmakers attended the bill signing. State Sen. Harriette Chandler, D-Worcester, a long-time advocate for the bill, said the new law will prevent ex-convicts from driving without a license and then getting more fines. “We are saying they did the crime, they paid their time and now they are going to rejoin society with some of the tools that are really important for them,” Chandler said.

Several lawmakers stressed that this is the first step in a larger criminal justice reform process that state policymakers are involved in. Massachusetts is currently participating in the Council of State Government’s Justice Reinvestment program, in which a task force analyzes data to determine how the state can reduce recidivism, lower costs and improve public safety.