Magic was worked on Messenger of Allah ﷺ so that he used to think that he had sexual relations with his wives while he actually had not (Sufyan said: That is the hardest kind of magic as it has such an effect).
Then one day he said, "O ʿAisha do you know that Allah has instructed me concerning the matter I asked Him about? Two men came to me and one of them sat near my head and the other sat near my feet. The one near my head asked the other. What is wrong with this man?' The latter replied the is under the effect of magic The first one asked, Who has worked magic on him?' The other replied Labid bin Al-A'sam, a man from Bani Zuraiq who was an ally of the Jews and was a hypocrite.' The first one asked, What material did he use)?' The other replied, 'A comb and the hair stuck to it.' The first one asked, 'Where (is that)?' The other replied. 'In a skin of pollen of a male date palm tree kept under a stone in the well of Dharwan' '' So the Prophet ﷺ went to that well and took out those things and said "That was the well which was shown to me (in a dream) Its water looked like the infusion of Henna leaves and its date-palm trees looked like the heads of devils." The Prophet ﷺ added, "Then that thing was taken out' I said (to the Prophet ﷺ ) "Why do you not treat yourself with Nashra?" He said, "Allah has cured me; I dislike to let evil spread among my people."
كَانَ رَسُولُ اللَّهِ ﷺ سُحِرَ حَتَّى كَانَ يَرَى أَنَّهُ يَأْتِي النِّسَاءَ وَلاَ يَأْتِيهِنَّ قَالَ سُفْيَانُ وَهَذَا أَشَدُّ مَا يَكُونُ مِنَ السِّحْرِ إِذَا كَانَ كَذَا
فَقَالَ يَا عَائِشَةُ أَعَلِمْتِ أَنَّ اللَّهَ قَدْ أَفْتَانِي فِيمَا اسْتَفْتَيْتُهُ فِيهِ أَتَانِي رَجُلاَنِ فَقَعَدَ أَحَدُهُمَا عِنْدَ رَأْسِي وَالآخَرُ عِنْدَ رِجْلَىَّ فَقَالَ الَّذِي عِنْدَ رَأْسِي لِلآخَرِ مَا بَالُ الرَّجُلِ قَالَ مَطْبُوبٌ قَالَ وَمَنْ طَبَّهُ قَالَ لَبِيدُ بْنُ أَعْصَمَ رَجُلٌ مِنْ بَنِي زُرَيْقٍ حَلِيفٌ لِيَهُودَ كَانَ مُنَافِقًا قَالَ وَفِيمَ قَالَ فِي مُشْطٍ وَمُشَاقَةٍ قَالَ وَأَيْنَ قَالَ فِي جُفِّ طَلْعَةٍ ذَكَرٍ تَحْتَ رَعُوفَةٍ فِي بِئْرِ ذَرْوَانَ قَالَتْ فَأَتَى النَّبِيُّ ﷺ الْبِئْرَ حَتَّى اسْتَخْرَجَهُ فَقَالَ هَذِهِ الْبِئْرُ الَّتِي أُرِيتُهَا وَكَأَنَّ مَاءَهَا نُقَاعَةُ الْحِنَّاءِ وَكَأَنَّ نَخْلَهَا رُءُوسُ الشَّيَاطِينِ قَالَ فَاسْتُخْرِجَ قَالَتْ فَقُلْتُ أَفَلاَ أَىْ تَنَشَّرْتَ فَقَالَ أَمَا وَاللَّهِ فَقَدْ شَفَانِي وَأَكْرَهُ أَنْ أُثِيرَ عَلَى أَحَدٍ مِنَ النَّاسِ شَرًّا