Is legislation the best defence against ransomware attacks?

Defence against cyber attacks is increasingly difficult as cybercriminals develop ever more sophisticated methods and their attacks are more frequent. Is legislation now a necessity?