We introduce a symplectic structure on the space of connections in a G-principal bundle over a four-manifold and the Hamiltonian action on it of the group of gauge transformations which are trivial on the boundary. The symplectic reduction becomes the moduli space of flat connections over the manifold. On the moduli space of flat connections we shall construct a hermitian line bundle with connection whose curvature is given by the symplectic form. This is the Chern-Simons prequantum line bundle. The group of gauge transformations on the boundary of the base manifold acts on the moduli space of flat connections by an infinitesimally symplectic way. This action is lifted to the prequantum line bundle by its abelian extension.