  Let G be a split connected reductive group over a finite field F_q, and N its
maximal unipotent subgroup. V. Drinfeld has introduced a remarkable partial
compactification of the moduli stack of N-bundles on a smooth projective curve
X over F_q. In this paper we study Drinfeld's moduli space and a certain
category of perverse sheaves on it. The definition of this category is
motivated by the study of the Whittaker functions on the group G(K), where
K=F_q((t)). We prove that our category is semi-simple, and that irreducible
objects of this category are "clean", i.e., they are extenstions by 0 of local
systems supported on the strata. As an application of these results, we obtain
a purely geometric proof of the Casselman-Shalika formula for the Whittaker
functions.
