We show that a compact Kaehler manifold with nonpositive holomorphic sectional curvature has nef canonical bundle. If the holomorphic sectional curvature is negative then it follows that the canonical bundle is ample, confirming a conjecture of Yau. The key ingredient is the recent solution of this conjecture in the projective case by Wu-Yau.