Inverse optimal control is the problem of computing a cost function that would have resulted in an observed sequence of decisions. The standard formulation of this problem assumes that decisions are optimal and tries to minimize the difference between what was observed and what would have been observed given a candidate cost function. We assume instead that decisions are only approximately optimal and try to minimize the extent to which observed decisions violate first-order necessary conditions for optimality. For a discrete-time optimal control system with a cost function that is a linear combination of known basis functions, this formulation leads to an efficient method of solution as an unconstrained least-squares problem. We apply this approach to both simulated and experimental data to obtain a simple model of human walking trajectories. This model might subsequently be used either for control of a humanoid robot or for predicting human motion when moving a robot through crowded areas.