Sahih al-Bukhari, Hadith 6961

Narrated Muhammad bin `Ali: `Ali was told that Ibn `Abbas did not see any harm in the Mut'a marriage. `Ali said, "Allah's Messenger forbade the Mut'a marriage on the Day of the battle of Khaibar and he forbade the eating of donkey's meat." Some people said, "If one, by a tricky way, marries temporarily, his marriage is illegal." Others said, "The marriage is valid but its condition is illegal."

حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا يَحْيَى، عَنْ عُبَيْدِ اللَّهِ بْنِ عُمَرَ، حَدَّثَنَا الزُّهْرِيُّ، عَنِ الْحَسَنِ، وَعَبْدِ اللَّهِ، ابْنَىْ مُحَمَّدِ بْنِ عَلِيٍّ عَنْ أَبِيهِمَا، أَنَّ عَلِيًّا ـ رضى الله عنه ـ قِيلَ لَهُ إِنَّ ابْنَ عَبَّاسٍ لاَ يَرَى بِمُتْعَةِ النِّسَاءِ بَأْسًا‏.‏ فَقَالَ إِنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم نَهَى عَنْهَا يَوْمَ خَيْبَرَ، وَعَنْ لُحُومِ الْحُمُرِ الإِنْسِيَّةِ‏.‏ وَقَالَ بَعْضُ النَّاسِ إِنِ احْتَالَ حَتَّى تَمَتَّعَ، فَالنِّكَاحُ فَاسِدٌ‏.‏ وَقَالَ بَعْضُهُمُ النِّكَاحُ جَائِزٌ وَالشَّرْطُ بَاطِلٌ‏.‏

sunnah.com