Many people in the West have an idea that Sufism is a separate sect of Islam, somewhat spiritual and peaceful. This is how Sufism is described, by an Islamic scholar in the classical manual on Sharia called Reliance of the Traveller:
w9.1 (Muhammad Amin Kurdi:) Sufism is a knowledge through which one knows the states of the human soul, praiseworthy or blameworthy, how to purify it from the blameworthy and ennoble it by acquiring the praiseworthy, and to journey and proceed to Allah Most High, fleeing unto Him. Its fruits are the heart’s development, knowledge of God through direct experience and ecstasy, salvation in the next world, triumph through gaining Allah’s pleasure, the attainment of eternal happiness, and illuminating and purifying the heart so that noble matters disclose themselves, extraordinary states are revealed, and one perceives what the insight of others is blind to (Tanwir al-qulub fi mu’amala ‘Allam al-Ghuyub (y74),406).
w9.2 (Nawawi:) The way of Sufism is based on five principles: having godfearingness privately and publicly, living according to the sunna in word and deed, indifference to whether others accept or reject one, satisfaction with Allah Most High in dearth and plenty, and returning to Allah in happiness or affliction. The principles of treating the illnesses of the soul are also five: lightening the stomach by diminishing one’s food and drink, taking refuge in Allah Most High from the unforeseen when it befalls, shunning situations involving what one fears to fall victim to, continually asking for Allah’s forgiveness and His blessings upon the Prophet (Allah bless him and give him peace) night and day with full presence of mind,. And keeping the company of him who guides one to Allah (al-Maqasid/i bayan ma yajibu ma’rifatuhu min aI-din (yl06), 83-84, 87).
w9.3 (Ahmad Zarruq:) Aspects of Sufism, defined, delineated, and explained, amount to nearly two thousand, all of them reducible to sincerity in turning to Allah Most High, something of which they are only facets, and Allah knows best. The necessary condition of sincerity of approach is that it be what the Truth Most High accepts, and by the means He accepts. Now, something lacking its necessary condition cannot exist, “And He does not accept unbelief for His servants” (Koran 39:7), so one must realize true faith (iman), “and if you show gratitude, He will accept it of you” (Koran 39:7), which entails applying Islam. So there is no Sufism except through comprehension of Sacred Law, for the outward rules of Allah Most High are not known save through it, and there is no comprehension of Sacred Law without Sufism, for works are nothing without sincerity of approach, as expressed by the words of Imam Malik (Allah have mercy on him):
“He who practices Sufism without learning Sacred Law corrupts his faith, while he who learns Sacred Law without practicing Sufism corrupts himself. Only he who combines the two proves true.” (Jqaz al-himam fi sharh al-Hikam (y54), 5-6)