Bay State jailbirds locked up for marijuana crimes could be set free under controversial legislation being crafted by Beacon Hill lawmakers and pro-pot advocates.

“We have to look at releasing folks who are in jail for marijuana crimes that are no longer crimes,” said Horace Small, executive director of the Union of Minority Neighborhoods. “It’s only fair now that the prohibition is over to retroactively erase these records. Sometime in the next month or two we’ll have a piece of legislation.”

The proposal comes amidst a growing appetite for criminal reform in the State House along with a push to cut steep incarceration costs. Small has been working with the ACLU, Sen. Jamie Eldridge (D-Acton) and others to craft a bill aimed at freeing some inmates as well as erasing the criminal records of those convicted of some marijuana possession and sales.

“We’ve approved medical marijuana, decriminalization and now legalization. It shows that the voters don’t believe the people who possess or sell marijuana should be in jail,” said Eldridge.

Both Eldridge and Small insist they aren’t looking to release hard-core drug dealers.

“This doesn’t apply to someone working for a cartel or something,” said Small, who is working with the same group of Northeastern University students he said helped craft the ballot question. “We need to look at what’s realistic and what’s over the top — there are a lot of conversations that we need to have.”

Eldridge admitted the number of inmates the legislation could impact is likely low, considering that many are locked up on multiple drug offenses.

“There are not many people in prison just on marijuana charges, but there certainly are people convicted of selling,” said Eldridge.

Bristol County Sheriff Thomas Hodgson blasted the proposal, saying lawmakers should trust the judges and juries who sent convicts to prison.

“It’s counterproductive and it undermines the judicial system,” Hodgson said, adding that some inmates held on marijuana charges have been pleaded down from more serious charges. “These lawmakers weren’t there for the facts of the case.”

The push comes ahead of an anticipated challenge from Donald Trump’s U.S. Attorney General nominee Jeff Sessions to pot legalization in states like Massachusetts and Colorado.

“I’m not sure this marijuana law won’t be repealed at some point,” said Hodgson. “Just because the marijuana law passed, it’s still a violation of federal law.”

Small said he expects pushback from law enforcement officials. But he thinks it could fly in the Legislature.

“We think that if given the opportunity the votes are there.”

He also said he’s confident that the bill could win over even pols who opposed legalization, such as Attorney General Maura Healey and Gov. Charlie Baker.

“We feel like the attorney general has made a strong reputation in identifying laws that are perceived as unfair,” Small said. He added that Baker might look at the votes the pot question got. “By the time this thing comes up in 2018, he’s up for re-election. We like our odds on this one.”