The evidence for this is the hadith of Wa'il ibn Hujr: “The Prophet ﷺ prayed, raising his hands at the opening takbir. He then wrapped himself in his garment and placed his right hand over his left. When he wished to bow, he brought his hands out from the garment, raised them, then pronounced the takbir and bowed.” (1) This hadith is recorded in Sahih Muslim. It shows that there is nothing wrong if a worshipper is wearing, for example, a cloak and wishes to draw part of it around the other part. This does not fall under his saying, “I have been forbidden to gather up my hair or garment,” (2) for every matter is judged according to its particular circumstances.
From this it becomes clear that there is nothing wrong with drawing the ghutrah back during the prayer, since this is a customary manner of wearing it. Thus, so long as one does not gather it up in a way that takes it beyond how people ordinarily wear it, there is no problem. Likewise, if he wraps it around his neck, there is nothing wrong with that. And if he wraps one end of his ghutrah around his neck and lets the other end hang down, there is likewise nothing wrong with it, because all of these are customary ways of wearing clothing; they are not regarded as gathering up a garment in an unconventional manner. This is why the Prophet ﷺ wrapped himself in his cloak, as mentioned above; wrapping oneself in it means drawing one part around the other.
His statement, “and killing a snake or a scorpion,” means that he may kill a snake. The particle here denotes permissibility, but this permissibility is intended to remove hardship; thus, it does not preclude the act from being recommended and prescribed. A worshipper may kill a snake; rather, it is sunnah for him to do so, because the Prophet ﷺ commanded it, saying: “Kill the two black creatures during the prayer: the snake and the scorpion.” (3)