Quantum computation represents an emerging framework to solve lattice gauge theories (LGTs) with arbitrary gauge groups, a general and long-standing problem in computational physics. While quantum computers may encode LGTs using only polynomially increasing resources, a major open issue concerns the violation of gauge invariance during the dynamics and the search for ground states. Here, we propose a class of parametrized quantum circuits that can represent states belonging only to the physical sector of the total Hilbert space. This class of circuits is compact yet flexible enough to be used as a variational Ansatz to study ground-state properties, as well as representing states originating from a real-time dynamics. Concerning the first application, the structure of the wavefunction Ansatz guarantees the preservation of physical constraints such as the Gauss law along the entire optimization process, enabling reliable variational calculations. As for the second application, this class of quantum circuits can be used in combination with time-dependent variational quantum algorithms, thus drastically reducing the resource requirements to access dynamical properties.