The defeat of good advice
David had trusted his friend Ahithophel for advice, but he turned against David during the rebellion of Absalom, and for that, David prayed that the Lord would turn the counsel of Ahithophel into foolishness.
The Lord answered David’s prayer and when Absalom sought additional advice here is what the Bible says happened,
“So Absalom and all the men of Israel said, ‘The advice of Hushai the Archite is better than the advice of Ahithophel.’ For the LORD had purposed to defeat the good advice of Ahithophel, to the intent that the LORD might bring disaster on Absalom” (2 Samuel 17:14).
Ahithophel had piled up a lifetime of good things, but at the end of his life he turned against his friend, and against God, and that cost Ahithophel everything.
Be sure to remain faithful till the day you die.