We investigate various aspects of invariance under local symmetries in the framework of perturbative algebraic quantum field theory (pAQFT). Our main result is the proof that the quantum Batalin–Vilkovisky operator, on-shell, can be written as the commutator with the interacting BRST charge. Up to now, this was proven only for a certain class of fields in quantum electrodynamics and in Yang–Mills theory. Our result is more general and it holds in a wide class of theories with local symmetries, including general relativity and the bosonic string. We also comment on other issues related to local gauge invariance and, using the language of homological algebra, we compare different approaches to quantization of gauge theories in the pAQFT framework.