You cannot delete a legal entity if there are references to it in departments.

To delete a legal entity created by mistake: