It is narrated from Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) that he said: "I heard a man praying for forgiveness for his parents although both of them were polytheists. So I said to him: 'Do you seek forgiveness for your parents when both of them are polytheists?' He replied: 'Did not Sayyiduna Ibrahim (peace be upon him) seek forgiveness for his father although he was a polytheist?'" Sayyiduna Ali (may Allah be pleased with him) relates: Then I mentioned this incident to the Prophet (peace and blessings be upon him), and these verses were revealed: "It is not for the Prophet and those who believe to seek forgiveness for the polytheists" to the end of the two verses.
Abu Ya'la al-Mawsili recorded it with a sahih chain.