Actually, that's not quite precise.  He was allowed to be picked by the Holy Spirit.  Just as the Holy Spirit allowed history's few bad popes to be picked.

He..the Holy Spirit..can draw good out of anything.