A multistage endoreversible Carnot heat engine system operating between a finite thermal capacity high--temperature fluid reservoir and an infinite thermal capacity low-temperature environment with a generalized heat transfer law [q ∝ (∆(T n )) m ] is investigated in this paper. Optimal control theory is applied to derive the continuous Hamilton-Jacobi-Bellman equations, which determine the optimal fluid temperature configurations for maximum power output under the conditions of fixed initial time and fixed initial temperature of the driving fluid. Based on the general optimization results, the analytical solution for the case with Newtonian heat transfer law [q ∝ ∆(T )] is further obtained. Since there are no analytical solutions for the other heat transfer laws, the continuous Hamilton-Jacobi-Bellman equations are discretized and the dynamic programming algorithm is adopted to obtain the complete numerical solutions of the optimization problem, and the relationships among the maximum power output of the system, the process period and the fluid temperature are discussed in detail. The results show that the optimal high-temperature fluid reservoir temperature for the maximum power output of the multistage heat engine system with Newtonian and linear phenomenological [q ∝ ∆(T −1 )] heat transfer laws decrease exponentially and linearly with time, respectively, while those with the Dulong-Petit [q ∝ (∆T )