When did the Cardinals start electing the Pope?

Hi: So I’m reading a very interesting book by James Hannam titled God’s Philosophers. The book is rebuke to commonly held opinions concerning a time period referred to as the “dark ages”. In chapter 2 Hannam notes that the princes of the Church tended to be related to the princes of state and the Pope was not elected by the Cardinals. My question is : when did the tradition of the Pope being selected by apostles end, and when did the selection by Cardinals begin and how did this come about?

The following link should help you better understand papal elections. If you have any further questions, please contact Catholic Answers directly.
Recommended Reading:**

Universi Dominici Gregis
by John Paul II

DISCLAIMER: The views and opinions expressed in these forums do not necessarily reflect those of Catholic Answers. For official apologetics resources please visit www.catholic.com.