  An abelian category of relative pure motives is constructed along the lines
of Andr\'e (over a field of characteristic 0). An algebraic stack is shown to
possess a motive in this sense. This motive is studied for the moduli stack of
G-bundles over the universal curve for appropriate G, and a motivic Atiyah-Bott
formula is obtained. By taking Hodge realization, a description of the
corresponding variations of Hodge structures over M_g is given. In particular,
it follows that these lie in the tensor category generated by the variation of
Hodge structure associated to the curve itself. Similar results are also given
for low degree variations of Hodge structures associated to the moduli space of
stable G-bundles.
