We show how to use optimal control theory to derive optimal time-consistent Markov-perfect government policies in nonlinear dynamic general equilibrium models, extending the result of Cohen and Michel (1988) for models with quadratic objective functions and linear dynamics. We replace private agents' costates by flexible functions of current states in the government's maximization problem.