Initially, Nathan encouraged David to carry out this plan. But God would not permit David to do so. This "word of God" ultimately proved to be more prophetic than either Nathan or David, both of whom surely believed this prophetic word to be fulfilled in a more this-worldly manner, could've imagined:
I was with you wherever you went, and I cut down all your enemies before you. I will make your name like that of the greatest on the earth. I will assign a place for my people Israel and I will plant them in it to dwell there; they will never again be disturbed, nor shall the wicked ever again oppress them, as they did at the beginning, and during all the time when I appointed judges over my people Israel. And I will subdue all your enemies. Moreover, I declare to you that the LORD will build you a house: when your days have been completed and you must join your ancestors, I will raise up your offspring after you who will be one of your own sons, and I will establish his kingdom. He it is who shall build me a house, and I will establish his throne forever. I will be a father to him, and he shall be a son to me, and I will not withdraw my favor from him as I withdrew it from the one who was before you; but I will maintain him in my house and in my kingdom forever, and his throne shall be firmly established forever (1 Chron 17:8-14)
Of course it was David's son, Solomon, who built the first Temple in Jerusalem. Why not David? The answer David gives to Solomon a bit further on in 1 Chronicles, which the king received as a word from God, another word with both an imminent and ultimate meaning, is an answer that speaks, certainly not in a completely satisfactory manner, to all the violence we encounter in the Hebrew Scriptures.
My son, it was my purpose to build a house myself for the name of the LORD, my God. But this word of the LORD came to me: You have shed much blood, and you have waged great wars. You may not build a house for my name, because you have shed too much blood upon the earth in my sight. However, a son will be born to you. He will be a peaceful man, and I will give him rest from all his enemies on every side. For Solomon shall be his name, and in his time I will bestow peace and tranquility on Israel.It is he who shall build a house for my name; he shall be a son to me, and I will be a father to him, and I will establish the throne of his kingship over Israel forever (1 Chron 22:7-10)