A mathematical model of the hydrostatic skeleton of the leech has been developed to predict the shape of and internal pressure within the animal in response to a given pattern of motor neuron activity in different behaviors. The model incorporates experimental data on: the dimensions of the animal at behavioral extremes, the passive properties of the tissues, the active length-tension behavior of the muscles in response to neural activation, the relations between firing frequencies and forces developed by the muscles. The model is based on three general assumptions: (i) the cross-sectional geometry of each segment is elliptical, (ii) the volume of each segment remains constant during movement, (iii) the shape of the animal reflects dimensions that minimize the total potential energy. Presently the model is implemented to simulate the vermiform elongation of the leech, predicting the shape and the pressure changes during behavior. The results are in good agreement with the experimental measurements. The pattern of motor neuronal activity was determined by the known intersegmental travel time and estimated delay time between relaxation of the longitudinal muscles and the activation of the circular muscles. The anesthetized state of the leech was taken as the reference state for the model in which the active and passive stresses are zero.