A proof of Nekhoroshev's theorem for the stability times in nearly integrable Hamiltonian systems