[Machine] The Messenger of Allah ﷺ would sometimes experience seminal emission during the night while intending to fast. He would then perform ghusl (ritual bath) after the dawn had broken and complete his fast.
كَانَ رَسُولُ اللهِ ﷺ تُصِيبُهُ الْجَنَابَةُ مِنَ اللَّيْلِ وَهُوَ يُرِيدُ الصَّوْمَ فَيَغْتَسِلُ بَعْدَمَا يَطْلُعُ الْفَجْرُ ثُمَّ يُتِمُّ صِيَامَهُ