  We examine the $L^2$-topology of the gauge orbits over a closed Riemann
surface. We prove a subtle local slice theorem based on the div-curl Lemma of
harmonic analysis, and deduce local pathwise connectedness and local uniform
quasiconvexity of the gauge orbits. Using these, we generalize compactness
results for anti-self-dual instantons with Lagrangian boundary counditions to
general gauge invariant Lagrangian submanifolds. This provides the foundation
for the construction of instanton Floer homology for pairs of a $3$-manifold
with boundary and a Lagrangian in the configuration space over the boundary.
