In a ruling critical of how Gov. Charlie Baker went about banning the sale of all vaping products for four months, a Superior Court judge on Monday allowed the administration's full ban to stay in effect, but only until next week unless changes are made.

The ruling left the governor's ban on marijuana vaping products untouched, but Judge Douglas Wilkins gave the administration until Monday to reissue the ban on nicotine vaping products as an emergency regulation.

The change in approach would force the administration to write a small business impact statement and hold a public hearing no later than Dec 24. Under state law, the duration of the ban would also be limited to three months, expiring on Christmas Eve unless a hearing is held to extend the ban.

"There is no harm to the public and no legally cognizable harm to the defendants if the court's order gives the opportunity to enact the Order as an emergency regulation," Wilkins said.

He concluded, "While the plaintiffs have shown a likelihood of success, the balance of harms weigh in defendants' favor in some respects, and an immediate injunction against the Order would contravene the public interest."

Baker and Department of Public Health Commissioner Monica Bharel were sued by the Vapor Technology Association, Ian Devine and Devine Enterprise, Inc. following his decision in September to declare a public health emergency and have the DPH order a four-month ban on all in-store and online sales of vaping products in Massachusetts.

The ban was a response to the nationwide outbreak of vaping-related lung injuries, but the plaintiffs allege that the governor overstepped his executive authority and violated the state constitution's separation of powers.

Wilkins sympathized with the plaintiffs, including the Vapor Technology Association, who the judge said "have certainly suffered, and will suffer, very great and irreparable financial impact" from the ban.

The judge also acknowledged that there is no strong consensus in the public health community as to the cause of the lung injuries.

Wilkins called the threat from THC and black market vaping products "clear and devastating," but said the Centers for Disease Control's assessment of nicotine products sold to adults is "less dire."

"Each side has presented experts, attacked by the other side as not credible. A credibility attack borders on futile, given the split in the public health community over whether a total ban on retail nicotine vaping products will do more harm than good," Wilkins wrote in his ruling.

Baker's next move is somewhat unclear. The administration could appeal the decision, amend its order or open an emergency regulatory proceeding.

"We need to spend a few minutes with our attorneys and with the attorney general processing the judge's decision," Baker told reporters Monday afternoon. "I appreciate the fact that the ban remains in place and that we have sort of a week here to figure out next steps if there are next steps that are required."

Baker said it would probably take "a day or two to make sure we get this right."

"For us from the beginning this was a public health question first and foremost and we recognize and ackowledge that the courts might be a place where this issue would play out, but I think for us the big issue is to recognize the ban is still in effect and it's up to us to decide how to act on the judge's decision, which is going to take us a day to figure out," he said.

In a statement earlier in the day, the governor's spokeswoman Elizabeth Guyton said the administration stands by its order, which was intended to allow time "to better understand what is making people sick."

"The administration maintains that the order was properly issued pursuant to the Commissioner’s emergency powers and will work with the Attorney General's Office on next steps," Guyton said.

Of the 1,479 cases of vaping related lung injury reported to the CDC nationwide, Massachusetts has referred 29 cases - 10 confirmed and 19 probable - to the federal government, including one death.

The governor has also said that his administration has looked at ways to help small business owners impacted by the ban, including vape shop owners who lost their sole source of income for four months.

"Unfortunately, we haven't figured out something that works for them," Baker said in an interview on WEEI last week.

The Vapor Technology Association was disappointed with the judge's ruling, and Executive Director Tony Abboud said the plaintiffs would be asking the court to revisit their request for an immediate injunction lifting the ban while their case moves through the legal process.

Abboud said the association was "pleased" that the court recognized the strength of the plaintiffs' case, the harm the ban has caused, and the distinction between nicotine vaping products and black-market THC products.

"We regret, however, the Court's decision to allow this improper ban to stay in place for a week while the State considers other regulatory alternatives. Based on the Court's findings, the ban should be enjoined immediately, and we will be asking for that relief," Abboud said in statement.

On the same day that Baker issued his ban on the sale of vape products, the Legislature began moving a bill more in line with what other states have done that would ban the sale of flavored tobacco and vaping products.

That bill is currently pending before the House Ways and Means Committee, but House Speaker Robert DeLeo and Ways and Means Chairman Aaron Michlewitz have said House leaders are eyeing a more "comprehensive" bill to address vaping, which could include a tax on e-cigarettes as proposed by the governor.