A legal framework from ecology