People generally tend to make friends with others who possess similar qualities of character. They prefer people who share their outlook on life, enjoy the same things, and with whom they can get along well. As a consequence, those who share the same views inevitably build a strong bond among themselves. Honorable and honest people attract honorable and honest people like themselves; they do not make friends with wicked people. People who are dishonest and prone to mischief, on the other hand, tend to associate with others who are dishonest.
Believers, who are the only group, among all others, with whose character Allah is pleased, must, in accordance to Allah's command, and in conformity with their natural inclination, always remain together.
Indeed, it is an act of worship commanded by Allah in the Qur'an. Allah commands believers to remain together with other believers, and not to obey those who are irreverent:
Believers are the only group of people on Earth that seek Allah's pleasure. Only they adopt the character traits with which Allah is pleased. These are not sufficient alone, however; it is necessary for there to be an environment where these values may be practiced and people to whom they may be exercised. Allah wants us to be just, to behave compassionately and mercifully, to enjoin what is right, and to adopt the values praised in the Qur'an. However, one cannot adhere to these values without the existence of other people. In other words, to be a compassionate and self-sacrificing person, one needs to be around the type of people who can appreciate this excellence of character, as well as deserve such treatment. Such people are the believers.
No sincere believer wants to make friends with someone who does not conduct himself as Allah commands, who has not adopted the values of the Qur'an, and thus, who wants only to be around other thoughtless people like himself. Furthermore, he does not nurture affection towards people who do not respect his beliefs, who condemn him because of his faith in Allah and his living his life by the values of the religion, and wants to drive him away from society and treat him with hostility:
Allah informs us that it is not right to harbour love for such people, nor to make friends with them, and adds that believers must always remain with other believers:
Of course, a believer must approach everyone, including unbelievers, with a friendly and tolerant manner, and treat them justly. However, treating unbelievers with tolerance and justice is very different from actually adopting them as close friends. A believer takes only those who are believers like him as friends. This is Allah's command: