Once Abraham settled in the land of Israel, along with his nephew Lot, he was forced to engage in a war involving five kings who rebelled against four Canaanite kings. (Gen. ch. 14)

Abraham went to war in order to rescue Lot, who, by mutual agreement, had made his homestead away from his uncle. (ch. 13) The Sages say that Lot had become involved in immorality, and therefore Abraham preferred that they live separately. But, if that's the case, why did Abraham see fit to rescue him afterwards from the four Canaanite kings who had captured him?

...because of the soul of King David who was within Lot at the time.

Here, the Maharal of Prague proposed a fascinating explanation. Abraham did this, "because of the soul of King David who was within Lot at the time." According to the Maharal, the soul of King David was dwelling in Lot, and for this reason Abraham had to rescue him.

It is well established that many very lofty souls would descend from Lot through one of his daughters. From her son named Moab, and from the nation he founded would come the convert Ruth, who would become the great-grandmother of King David, the progenitor of Mashiach ben David. But the idea that the actual soul of King David was en-clothed in an immoral person like Lot is hard to fathom.

Shem miShmuel explains:

We know that the four kings represented forces of evil which prevented the revelation of G‑dliness in the world. Three of the kings corresponded to the cardinal sins of idolatry, murder, and sexual offenses (such as incest). The fourth king was as bad as all of them combined, though we're not told exactly what his transgressions were.

Spiritually opposing these wicked kings were the three forefathers – Abraham, Isaac, Jacob – and King David. But, each of them, in his turn, had to go through purification, in order to become the tzadik that we now know him as, and to rectify these terrible sins.

Abraham, the man of loving-kindness, had to go through the trial of sojourning in Egypt, which on the surface looked like a beautiful place, but really captured and concealed anything spiritual or G‑dly. By briefly sojourning in Egypt (and by undergoing circumcision), he rectified the transgression of sexual immorality.

Isaac, the man known for his fear of G‑d, had to confront the Philistines, a people known for their habit of scoffing and laughing at everything – the opposite of standing in awe of G‑d. By spending a period of time among the Philistines, Isaac rectified the transgression of idol worship.

And Jacob, the man of truth, had to undergo the tests of Esau and Laban, both of them liars and murderers. Thus, he rectified the transgression of murder. Having undergone these tests and overcome them, the forefathers became the paragons of their respective paths of service of G‑d.

Finally, we come to King David, who had to undergo the most unique type of purification.

King David narrates over and over again how humble his life experiences have made him.

When we examine the Psalms authored by King David, the trait that stands out is his humility. King David narrates over and over again how humble his life experiences have made him. Whether he is being pursued by Saul, or fighting Goliath, or repenting over his sins, he is the most humble and self-effacing of men.

But, in Lot we see the opposite. Lot saw himself as the heir to Abraham, and indeed, as the father of the world. It was his haughtiness and arrogance which qualified him as the fourth and worst of the negative forces. Arrogance includes, and leads to, all of the other cardinal sins mentioned above. King David's soul had to be clad in Lot's arrogant body in order for King David to undergo the necessary purification and emerge as the humble King of Israel from whom Mashiach would come.

Abraham understood that, and this is why he went to war in order to rescue his nephew. And it is because of him that we find ourselves living today "on the heels of Mashiach," as we await the final redemption.

[From "Inner Lights from Jerusalem": based on the Shem miShmuel and other Chassidic and Kabalistic Sources, by Rabbi David Sterne, who also authored "Love Like Fire and Water: A Guide to Jewish Meditation."]