The environment is “the full range of conditions and circumstances in which biological organisms live.” So, ideally at least, ecology is both the system itself and the study of it, and environment is the detailed locus in which such a system operates. Ecology should not be substituted for “environment” in statements like “improperly discarded lead batteries harm the ecology.” It’s not the relationships that are being harmed, but nature itself: the batteries are harming the environment.