  We propose a relation between the operator of S-duality (of N=4 super
Yang-Mills theory in 3+1D) and a topological theory in one dimension lower. We
construct the topological theory by compactifying N=4 super Yang-Mills on a
circle with an S-duality and R-symmetry twist. The S-duality twist requires a
selfdual coupling constant. We argue that for a sufficiently low rank of the
gauge group the three-dimensional low-energy description is a topological
theory, which we conjecture to be a pure Chern-Simons theory. This conjecture
implies a connection between the action of mirror symmetry on the sigma-model
with Hitchin's moduli space as target space and geometric quantization of the
moduli space of flat connections on a Riemann surface.
