Sayyiduna Ibn Mas'ud (may Allah be pleased with him) narrates that once we were sitting in the Prophet's Mosque on a Friday evening when an Ansari said: If any one of us sees a man with his wife and kills him, you kill him in retaliation; if he speaks out, you flog him; and if he remains silent, he does so in anger. By Allah! If I am alive in the morning, I will surely ask the Prophet (peace and blessings be upon him) about this matter. So he asked the Prophet (peace and blessings be upon him) about this issue and said: O Messenger of Allah (peace and blessings be upon him)! If any one of us sees a strange man with his wife and kills him, you kill him in retaliation; if he speaks, you flog him; and if he remains silent, he does so in anger? O Allah! Decide between us. Then the verse of Li'an was revealed.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 4281