A few points on company and the preconditions of it and its adab.
He (ibn ‘Ata’ullah al-Iskandari), may Allah be well pleased with him, said:
If someone’s state does not lift you up,
and his words do not lead you to Allah
– then do not keep his company!
The one whose state lifts you up is someone who is such that, when you see him, you remember Allah. If you see him when you are in a state of heedlessness, he lifts you to a state of wakefulness. If you see him when you are in a state of desire, he raises you to a state of asceticism. If you see him when you are in a state of occupation with disobedience, he raises you to a state of repentance. If you are in a state of ignorance of your Lord, he raises you to recognition of your Lord, and so forth.
The one whose words guide you to Allah is the one who speaks by Allah. He directs you to Allah and withdraws from other than Him. When he speaks, he takes all the hearts, and when he is silent, his state raises you to the Knower of the Unseen worlds. So his state confirms his words and his words are in harmony with his knowledge. The company of someone like this is an elixir which transforms the sources. This is understood from the words of the shaykh, “If someone’s state does not life you up, then do not keep his company.” Keep the company of the one whose state will lift you up and whose words will lead you to Allah.
It may well be that you are in a bad state –
but to keep company with someone worse than you
would allow you to see good in yourself.
If you have a bad state and fall short in your actions and then you keep the company of someone with a worse state than you, your company with someone with a worse state than yours lets you see good in yourself since you see the good in yourself in relation of your companion’s shortcoming and perfection. You therefore believe that you are superior to him because the self is naturally disposed to see its own excellence and witness the shortcomings of others in knowledge, action, or state. This is not the case when you keep the company of someone with a better state than you. Then you only see shortcoming in yourself, and there is much good in that.
Shaykh ash-Shadhili said, “My Beloved commanded me, ‘Do not move your feet except where you hope for the reward of Allah and do not sit except where you are generally safe from disobeying Allah and do not choose for yourself other than the one who provides you with certainty. And they are very few indeed.'” He also said, “Do not accompany the one who prefers his nafs to you. He is blameworthy. Do not accompany the one who prefers you to himself. He is rarely constant. Rather keep the company of the one who, when he remembers, remembers Allah. Allah enriches by him when he is present and represents him when he is absent. His dhikr illuminates the hearts and his witnessing is the keys of the unseen worlds.”
In short, do not keep the company of those for whom you take on a burden beyond your efforts nor the one who burdens you in the same way. The best of matters is the middlemost one. This, and Allah knows best, concerns the company of brothers.
Sahl ibn ‘Abdullah said, “Beware of the company of three sorts of people: heedless tyrants, reciters who flatter, and ignorant false Sufis.” Shaykh Zarruq added, “Scholars of the outward meaning.” He said, “Because they are dominated by their nafs.”