  The energy of harmonic sections of flat bundles of nonpositively curved (NPC)
length spaces over a Riemann surface $S$ is a function $E_\rho$ on
Teichm\"uller space $\Teich$ which is a qualitative invariant of the holonomy
representation $\rho$ of $\pi_1(S)$. Adapting ideas of Sacks-Uhlenbeck,
Schoen-Yau and Tromba, we show that the energy function $E_\rho$ is proper for
any convex cocompact representation of the fundamental group. More generally,
if $\rho$ is a discrete embedding onto a normal subgroup of a convex cocompact
group $\Gamma$, then $E_\rho$ defines a proper function on the quotient
$\Teich/Q$ where $Q$ is the subgroup of the mapping class group defined by
$\Gamma/\rho(\pi_1(S))$. When the image of $\rho$ contains parabolic elements,
then $E_\rho$ is not proper. Using the recent solution of Marden's Tameness
Conjecture, we show that if $\rho$ is a discrete embedding into $\SLtC$, then
$E_\rho$ is proper if and only if $\rho$ is quasi-Fuchsian. These results are
used to prove that the mapping class group acts properly on the subset of
convex cocompact representations.
