  We analyse dependence of the partition function on the boundary condition for
the longitudinal component of the electric field strength in gauge field
theories. In a physical gauge the Gauss law constraint may be resolved
explicitly expressing this component via an integral of the physical
transversal variables. In particular, we study quantum electrodynamics with an
external charge and SU(2) gluodynamics. We find that only a charge distribution
slowly decreasing at spatial infinity can produce a nontrivial dependence in
the Abelian theory. However, in gluodynamics for temperatures below some
critical value the partition function acquires a delta-function like dependence
on the boundary condition, which leads to colour confinement.
