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 strange man with his wife and kills him, then 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 issue. So he asked the Prophet (peace and blessings be upon him) about this matter and said: O Messenger of Allah! If any one of us sees a strange man with his wife and kills him, then you kill him in retaliation; if he speaks out, you flog him; and if he remains silent, he does so in anger? O Allah! Decide (between us). So the verse of Li'an was revealed, and he was the first to be tested with it (this incident happened with him).
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 4001