DENVER — When Colorado legalized marijuana two years ago, nobody was quite ready for the problem of exploding houses.

But that is exactly what firefighters, courts and lawmakers across the state are confronting these days: amateur marijuana alchemists who are turning their kitchens and basements into “Breaking Bad”-style laboratories, using flammable chemicals to extract potent drops of a marijuana concentrate commonly called hash oil, and sometimes accidentally blowing up their homes and lighting themselves on fire in the process.

The trend is not limited to Colorado — officials from Florida to Illinois to California have reported similar problems — but the blasts are creating a special headache for lawmakers and courts here, the state at the center of legal marijuana. Even as cities try to clamp down on homemade hash oil and lawmakers consider outlawing it, some enthusiasts argue for their right to make it safely without butane, and criminal defense lawyers say the practice can no longer be considered a crime under the 2012 constitutional amendment that made marijuana legal to grow, smoke, process and sell.

“This is uncharted territory,” said State Representative Mike Foote, a Democrat from northern Colorado who is grappling with how to address hash-oil explosions. “These things come up for the first time, and no one’s dealt with them before.”