The purpose of this chapter is to provide a detailed probabilistic analysis of the optimal control of nonlinear stochastic dynamical systems of McKean-Vlasov type. We tackle the characterization and construction of solutions of this special type of optimal control problem by means of forward-backward stochastic differential equations. Because of the presence of the distribution of the controlled state in the coefficients, the approach based on the Pontryagin stochastic maximum principle requires special attention. We provide a version of this maximum principle based on the differential calculus for functions of probability measures introduced and developed in Chapter 5 We test the results of the analysis on linear quadratic models and a few other models already considered in the framework of mean field games. Finally, we highlight the similarities and the differences between this problem and MFG problems with which it is often confused.