  In this article we study an optimal control problem subject to the
Fokker-Planck equation \[ \partial_t \rho - \nu \Delta \rho - {\rm div }
\big(\rho B[u]\big) = 0. \] The control variable $u$ is time-dependent and
possibly multidimensional, and the function $B$ depends on the space variable
and the control. The cost functional is of tracking type and includes a
quadratic regularization term on the control. For this problem, we prove
existence of optimal controls and first order necessary conditions. Main
emphasis is placed on second order necessary and sufficient conditions.
