The key element of the approach to the theory of necessary conditions in optimal control discussed in the paper is reduction of the original constrained problem to unconstrained minimization with subsequent application of a suitable mechanism of local analysis to characterize minima of (necessarily nonsmooth) functionals that appear after reduction. Using unconstrained minimization at the crucial step of obtaining necessary conditions definitely facilitates studies of new phenomena and allows to get more transparent and technically simple proofs of known results. In the paper we offer a new proof of the maximum principle for a nonsmooth optimal control problem (in the standard Pontryagin form) with state constraints and then prove a new second order condition for a strong minimum in the same problem but with data differentiable with respect to the state and control variables. The role of variational analysis is twofold. Conceptually, the main considerations behind the reduction are connected with metric regularity and Ekelands principle. On the other hand, technically, calculation of subdifferentials of components of the functionals that appear after the reduction is an essential part of the proofs.