1 Kings 2:11

And the days that David reigned over Israel were forty years: seven years reigned he in Hebron, and thirty and three years reigned he in Jerusalem.

David reigned over Israel forty years in all, seven years in Hebron and thirty-three years in Jerusalem. The opening part of Kings to which this belongs continues with the history of the undivided kingdom under Solomon, and the corresponding opening section of Chronicles covering the same period is arranged in chronological order. It stands at the close of the record of the war between Israel and Judah, after years of conflict between Saul's son and David, ending with David's triumph as the beloved king over all the tribes.

The account shows that God chooses the rulers of His people rather than allowing a king's son to continue on the throne simply to imitate the surrounding nations. The verse is included in the account of David's later history that records his grave sin involving Uriah and the judgments that followed Nathan's denunciation. It is part of the account of David's final days when Adonijah attempted to seize the throne and the plot ended in his overthrow and death, which was another fulfillment of Nathan's declaration that the sword would not depart from David's house.

During the reign described, a forty-year period came to an end when Absalom conspired against his father's kingdom. The surrounding chapter shows God's just retribution upon Shimei for his wickedness toward David in David's dark hour. Absalom had drawn the people after himself with fair words so that David fled Jerusalem with only a few men to save his life, and Shimei came out cursing David, casting stones and dust at him and his men, and accusing him of being a wicked and bloody man whose calamities proved God was not with him, abuse which David bore meekly until God acted for him.

The verse belongs to the account of the transition from David's reign to Solomon's, in which David remains king until Solomon is established on the throne and the account of David ends with his death. It places David's death at the end of his reign, after he yielded the throne to Solomon as old age brought his life to its close, living to see Solomon established as king. The total reign length of forty years makes a reading of forty years in the account of Absalom's rebellion chronologically impossible, since it would place the rebellion after David's death, so that passage should be understood to mean four years.

The verse presents David as one of three kings God permitted Israel to have after the people in discontent with their divine ruler demanded an earthly king to be like the surrounding heathen nations. His forty years together with two other forty-year reigns makes one hundred and twenty years of kingship, yet this liberty did not awaken gratitude to God nor produce peace, unity and righteousness, and soon after Solomon died rebellion burst forth and ruptured the kingdom.