Sayyiduna Anas bin Malik (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) entered (Makkah) in the year of the Conquest of Makkah, and on his (peace and blessings be upon him) blessed head was a helmet. When he (peace and blessings be upon him) took it off, a man came and said: Ibn Khatal is clinging to the curtains of the Ka'bah. He (peace and blessings be upon him) said: "Kill him." Malik (may Allah have mercy on him) says: The Messenger of Allah (peace and blessings be upon him) was not in the state of ihram at that time.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 9840