Although King David repented of his sins involving Bath - sheba, he was not shielded from the consequences of his actions.
عَلَى سَبِيلِ ٱلْمِثَالِ ،‏ رَغْمَ أَنَّ ٱلْمَلِكَ دَاوُدَ تَابَ عَنْ خَطَايَاهُ فِي قَضِيَّةِ بَثْشَبَعَ ،‏ لَمْ يَحْمِهِ يَهْوَه مِنَ عَوَاقِبِ تَصَرُّفَاتِهِ .‏