The strong arm of the law: a unified account of necessary and contingent laws of nature