To Live By the Sword?

Over the course of more than a thousand years, four separate incidents emerged that all share one striking detail. Because of this common element, various poskim have discussed them together.
The First Incident
Zimri and Kozbi were caught publicly desecrating Hashem’s name. In addition, Zimri went so far as to question the character of Moshe Rabbeinu. Recognizing the gravity of the situation, Pinchas knew what action was required. After consulting with Moshe, he left the Beis Medrash, retrieved his sword, and entered Zimri’s tent with his weapon concealed – where he killed both Zimri and Kozbi.
The Second Incident
Years later, as the nation of Israel suffered under the relentless taunts of Goliath, a future King Dovid stepped forward to confront the challenge. Shaul Hamelech provided Dovid with his own royal armor. Even though Shaul was taller, miraculously, the armor fit Dovid perfectly. Shaul took this as an omen, pondering whether Dovid’s lineage qualified him to be king. Doeg interjected with a provocative question: before assessing Dovid’s suitability for kingship, should one not first consider whether he was even fit to join the Jewish congregation? After all, Dovid was a descendant of Rus Hamoavia, and converts from Moav and Amon are barred from marrying into the Jewish nation.