As simulations of 21st-century climate start to include components with longer timescales, such as ice sheets, the initial conditions for those components will become critical to the forecast. This paper describes an algorithm for specifying the initial state of an ice-sheet model, given spatially continuous observations of the surface elevation, the velocity at the surface and the thickness of the ice. The algorithm can be viewed as an inverse procedure to solve for the viscosity or the basal drag coefficient. It applies to incompressible Stokes flow over an impenetrable boundary, and is based upon techniques used in electric impedance tomography; in particular, the minimization of a type of cost function proposed by Kohn and Vogelius. The algorithm can be implemented numerically using only the forward solution of the Stokes equations, with no need to develop a separate adjoint model. The only requirement placed upon the numerical Stokes solver is that boundary conditions of Dirichlet, Neumann and Robin types can be implemented. As an illustrative example, the algorithm is applied to shear flow down an impenetrable inclined plane. A fully three-dimensional test case using a commercially available solver for the Stokes equations is also presented.