This paper presents a task-priority motion planning algorithm for underactuated robotic systems. The motion planning algorithm combines two features: the idea of the task-priority control of redundant manipulators and the endogenous configuration space approach. This combination results in the algorithm which solves the primary motion planning task simultaneously with one or more secondary tasks ordered in accordance with decreasing priorities. The performance of the task-priority motion planning algorithm has been illustrated with computer simulations of the motion planning problem for a container ship.