Templates play a fundamental role in Computational Anatomy. In this paper, we present a Bayesian model for template estimation. It is assumed that observed images I(1), I(2),...,I(N) are generated by shooting the template J through Gaussian distributed random initial momenta theta(1), theta(2),...,theta(N). The template is J modeled as a deformation from a given hypertemplate J(0) with initial momentum mu, which has a Gaussian prior. We apply a mode approximation of the EM (MAEM) procedure, where the conditional expectation is replaced by a Dirac measure at the mode. This leads us to an image matching problem with a Jacobian weight term, and we solve it by deriving the weighted Euler-Lagrange equation. The results of template estimation for hippocampus and cardiac data are presented.