Grab a pen and paper and try to write down the names of all your friends, and then classify them into categories. You will discover that some of them are not really friends but rather casual companions.
One of them may be your work colleague. You may be an employee, and his office is opposite to yours, and you see him all day long. You may be a worker, and his machine is right next to yours. Or he may be working with you in the same store, or his store is next to yours in the marketplace. You spend more time with him than with your own family, and you meet with him more often than you meet with your friends and loved ones! You may share moments of seriousness, humor, contentment, and anger with him, while the two of you have totally different appearances, minds, and backgrounds.
You may also find on the list a traveling companion whom you meet on a train or in the bus and share the desire to ward off boredom. You exchange greetings and small talk, or make some observations on what you see and hear during the journey. Within a few hours, you share food and you fall asleep in the same space. The barriers between you start to fall and you see and know about one another what only your household members or close relatives would see or know about you, although you are totally unrelated and you have no brotherly affection for each other.
You neither picked them willingly to be your friends nor chose their companionship, but life put them in your way and burdened you with them. If you do not conduct an inventory of them the way a merchant conducts an inventory of his merchandise then you vet them and only keep the good ones and cast away the bad ones, you would not know down which abyss such friendships lead you. A companion drags his companions down the path he is treading, and they tend to follow his example.
You may accompany a person down a path or a journey or know him from work and interact with him friendly as courteously as a well-mannered person should interact with others while being unaware of his life. He would become associated with you, and he becomes known as your “friend,” and his evils would affect you accordingly.
You may be harmed by such association, and he may become a source of disgrace to you. He may also influence you in a way you are unaware of. Every word you hear can be likened to a seed thrown into a fertile land; it may be a good seed that generates goodness within you, or an evil one that gives rise to evil within you.
Many righteous people were corrupted because they kept the company of a wicked person who changed their state drastically and made life misery for them. Conversely, many wicked people were rectified and became righteous because they kept the company of the righteous. A person may be safe from his sinful urges on his own and distract himself from them with knowledge or art, or practicing spiritual or physical exercise, but a wicked companion may come along, out of the blue, to trigger such sinful urges within him and cause him to taste their bitterness.
Another may be living a sinful life leading him ultimately to Hellfire, but he would be blessed with a righteous friend who would steer him away and lead him towards Paradise (Al-Jannah) instead. A friend who reminds you of Allah is not like the one who causes you to forget His remembrance. A friend who leads you to the mosque for worship is not like the one who leads you to a brothel to commit sin. A friend who tells you about a book that he read and encourages you to read it as well is not like the one who describes the beauty of a female dancer that he had watched to incite you to watch her too.
If you seek a friendship that fosters your righteousness and a deed that rectifies all deeds, then write down the names of your friends, companions, and acquaintances with whom you are on friendly terms, and investigate the state of each and every one of them: is he righteous or unrighteous? Is he loyal to his friends, or does he only care about what benefits and pleases him? Is he a source of comforting company, or is he rough and annoying? If you do so, you will find that your companions are indeed different. You will find among them the one who is devoted to fasting and prayer and has the outward appearance of the righteous but is actually using this ‘outward righteousness’ as a ladder to rise in the world and a trap to catch money thereby. You will find out that his true character belies his false pretense of piety. If you make a covenant with him, he betrays you, and if you enter into a transaction with him, he cheats you.
You will also find the one who is honest and trustworthy, but he does not observe fasting nor prayer and is a Muslim in name only. Such a companion will ruin your religiosity.
You will find among them the one who is a righteous, devout worshiper, who is trustworthy and honest, but he has an insatiable lust and unbridled urges, and he talks about nothing else. He refrains from committing sins but indulges in speaking about them! Such a person harms you by arousing your dormant desires and waking the latent urges inside you.