In this paper, we study the SIR epidemic model with vital dynamics S ̇ = − β S I + μ N − S , I ̇ = β S I − γ + μ I , R ̇ = γ I − μ R , from the point of view of integrability. In the case of the death/birth rate μ = 0 , the SIR model is integrable, and we provide its general solutions by implicit functions, two Lax formulations and infinitely many Hamilton-Poisson realizations. In the case of μ ≠ 0 , we prove that the SIR model has no polynomial or proper rational first integrals by studying the invariant algebraic surfaces. Moreover, although the SIR model with μ ≠ 0 is not integrable and we cannot get its exact solution, based on the existence of an invariant algebraic surface, we give the global dynamics of the SIR model with μ ≠ 0 .