What would happen in the many communities now allowing medical marijuana had been a subject of much hand-wringing. But few predicted this: that it would be a boon for local newspapers looking for ways to cope with the effects of the recession and the flight of advertising — especially classified listings — to Web sites like Craigslist.

But in states like Colorado, California and Montana where use of the drug for health purposes is legal, newspapers — particularly alternative weeklies — have rushed to woo marijuana providers. Many of these enterprises are flush with cash and eager to get the word out about their fledgling businesses.

“Medical marijuana has been a revenue blessing over and above what we anticipated,” said John Weiss, the founder and publisher of The Independent, a free weekly. “This wasn’t in our marketing plan a year ago, and now it is about 10 percent of our paper’s revenue.”

It is hard to measure what share of the overall market they account for, but ads for medical marijuana providers and the businesses that have sprouted up to service them — tax lawyers, real estate agents, security specialists — have bulked up papers in large metropolitan news markets like Los Angeles, San Francisco and Denver.

“This is certainly one of the fastest growing industries we’ve ever seen come in,” said Scott Tobias, president and chief operating officer of Village Voice Media, which publishes alternative weeklies across the country.