  We calculate certain homotopy groups of the moduli spaces for representations
of a compact oriented surface in the Lie groups GL(n,C) and U(p,q). Our
approach relies on the interpretation of these representations in terms of
Higgs bundles and uses Bott--Morse theory on the corresponding moduli spaces.
