King David was betrayed during the revolt of Absalom by his counselor, Ahitophel, who joined the opposing side.