Joab was the leader of King David's armies, most famously in his war with the Saul, and, after Saul's death, with his son Ish-Bosheth. His story is told in II Samuel and I Kings in the Old Testament of the Bible.
Joab was not a man of honor, even disobeying his own king, but he did protect David. Joab killed Abner when they had come together to talk, killed Absalom when he had been ordered by David not to, and killed Amasa when they came together to talk.
Eventually Joab made another mistake when in his brashness he supported the decision of Adonijah, David's son, to make himself the next king over Solomon while David still lived. David, hearing of what had happened, proclaimed Solomon king and the support for Adonijah evaporated. On David's dying bed he reminded Solomon of the sins of Joab killing Abner and Amasa during meetings of peace and stated that Joab should not be allowed peacefully to the grave due to old age. When Adonijah tried to again take power for himself by asking for the right to marry David's widow, Solomon had him killed. When Joab heard, he tried to seek sanctuary, but Solomon had him killed as well, thus fulfilling David's deathbed request.