Sayyiduna Ali bin Abi Talib (may Allah be pleased with him) narrates: I heard the Prophet (peace and blessings be upon him) say: "I never intended to do any of the deeds that the people of the Age of Ignorance used to do, except on two occasions, and each time Allah Almighty became a barrier between me and what I intended. After that I never intended anything of that kind, until Allah Almighty honoured me with His Messengership."
Al-Bazzar recorded it, and its narrators are thiqat (trustworthy).