Do what I say!
Legal obligations are set out in laws, right? Ultimately they are. However many obligations are made contingent on decisions made by government officials.
In some legislation it is an offence to fail to comply with a direction by a government official. An example is section 76A of the Domestic Animals Act 1994 (Vic) under which an authorised officer is empowered to issue a notice to comply if the authorised officer believes on reasonable grounds that the person has committed an offence. It is an offence to fail to comply with the notice. In NSW a local government officer can “order” a person to do or refrain from doing a specified activity.
To use some Latin, the issuing of the notice or the making of the order is part of the factum of the offence.
A variant on this theme is a permit system. Under this approach, it is an offence to conduct an activity without a permit. If an activity occurs in accordance with a permit (including its “conditions”) the activity is lawful. If the activity occurs without a permit, or in breach of a permit condition, an offence is committed.
Even more simply, legislation can require “prior approval” for an activity (s 68 of the Local Government Act 1993 (NSW)).
Don’t do it unless I say you can!