Continuing the study of the relationship between the Heun and the Painlevé classes of equations reported in two previous papers, we formulate and prove the main theorem expressing this relationship. We give a Hamiltonian interpretation of the isomonodromic deformation condition and propose an alternative classification of the Painlevé equations, which includes ten equations.