Police in Ontario are warning municipalities about a rash of cyberattacks targeting local governments in which hackers demand a ransom in exchange for access to systems.

Ontario Provincial Police did not provide firm numbers on the ransomware incidents but say there have been several such attacks on businesses and municipal offices in recent months.

One recent incident took place earlier this month in Midland, Ont., when town administrators found themselves locked out of many municipal systems and asked to pay an undisclosed sum to regain access to the data.

Midland Mayor Gord McKay says the town had recently purchased insurance to deal with such issues, prompted by a similar attack in nearby Wasaga Beach, Ont., three months earlier.

He says the insurance company has been handling communications with the alleged hackers and that all of Midland's systems are expected to be back up and running by next week.

The OPP says it does not support paying ransoms in such cases on the grounds that doing so encourages crime, but the force says those impacted by such attacks must decide for themselves how to proceed.