PROVIDENCE, R.I. — The Rhode Island Senate passed compromise legislation Wednesday intended to recharge a stalled effort to open medical marijuana dispensaries with new limits on how much of the drug they may possess.

If the proposal passes the House as well, the dispensaries could be serving patients within several months.

The vote represents progress to dispensaries that were poised to open last year when Gov. Lincoln Chafee held up their permits because of the threat of federal prosecution.

“We’ve waited three years for a safe place patients can go to get the medicine they need,” said Chris Reilly, a spokesman for the Slater Compassion Center in Providence, one of three dispensaries — or compassion centers — selected by state health regulators last year before Chafee intervened.

Chafee and lawmakers worked out the compromise with the hope that it might satisfy federal authorities, but it remains to be seen whether they succeeded.

The U.S. Justice Department remains concerned about “large-scale commercial cultivation and distribution” of marijuana, according to a statement from Peter Neronha, the U.S. attorney for Rhode Island. Neronha warned last year that while patients wouldn’t face prosecution, dispensary operators might.

“Anyone engaging in such activities is subject to a variety of potential federal criminal and civil remedies, including forfeiture of the real estate where such centers or associated activities are located,” Neronha said in his statement Wednesday.

Under the bill, dispensaries would be allowed to possess up to 1,500 ounces of marijuana. Other provisions designed to assuage federal concerns included one allowing state police to inspect dispensaries and another giving the state police a seat on the board overseeing the facilities.

Sen. Rhoda Perry, D-Providence, helped craft the compromise and calls it a conservative, good-faith effort to let the dispensaries operate without the fear of federal intervention.

“What’s important to us is getting the licensing process back on track so the facilities can open and safely get some relief to suffering people,” she said. “Every day these centers aren’t open is another day that many sick and dying Rhode Islanders and their families or caregivers are forced to turn to unsafe, illegal means to get their medicine.”

The House could vote on the measure as early as next week.

The bill passed 35-3 in the Senate. One of those “no” votes, Sen. Glenford Shibley, said he has doubts about marijuana’s medical value and said the dispensaries could turn out to be a “nightmare.”

“I’m not against people who are hurting,” said the Coventry Republican. “Compassion sounds nice. But it’s definitely wrong. There are other medicines to take. I’m kind of embarrassed on the Senate floor watching this go through.”

More than 4,400 Rhode Islanders are now enrolled in the state’s medical marijuana program.

State law allows patients to legally possess small amounts of marijuana to treat conditions including chronic pain, severe nausea, seizures and multiple sclerosis. In 2009, lawmakers passed legislation to set up compassion centers where patients could obtain marijuana in a state-regulated environment.

Last year, the Health Department picked three dispensaries and was preparing to finalize their licenses when Chafee halted the process. The dispensaries are the Thomas C. Slater Compassion Center in Providence, Summit Medical Compassion Center in Warwick and Greenleaf Compassionate Care Center in Portsmouth.