Manipulation robots belong to a class of complex, nonlinear dynamic systems. In addition, they are subjected to the constraints resulting from work-space obstacles, kinematical and physical characteristics of the mechanism itself and the actuators. Therefore, the application of optimal control theory (in energy or time optimization) leads to substantial practical difficulties, so that significant simplifications are usually performed, either in model complexity or by neglecting the existing constraints. In this paper the problem of obtaining such an optimization method, which would take into account the complete system dynamics and all the constraints is considered. The only method found to be suitable for such a complex optimization should be based on dynamic programming. In this paper an algorithm for determining optimal velocity distribution for a given manipulator tip trajectory is elaborated in detail. Practical application of the developed procedure is in off-line calculation of nominal input generalized forces (programmed control) of a nonredundant manipulator, by which the minimum of consumed energy is ensured. This is specially important for high speed motions as well as handling of heavy loads.