Imam al-Nawawi's introduction to this chapter
اعْلم أنَّ الاختلاط بالنَّاسِ عَلَى الوجهِ الَّذِي ذَكَرْتُهُ هُوَ المختارُ الَّذِي كَانَ عَلَيْهِ رسول الله - صلى الله عليه وسلم - وسائر الأنبياء صلواتُ اللهِ وسلامه عَلَيْهِمْ، وكذلك الخُلفاءُ الرَّاشدون، ومن بعدَهُم مِنَ الصَّحَابَةِ وَالتَّابِعِينَ، ومن بَعدَهُم من عُلَماءِ المُسلمين وأَخْيَارِهم، وَهُوَ مَذْهَبُ أكثَرِ التَّابِعينَ وَمَنْ بَعدَهُمْ، وبه قَالَ الشافعيُّ وأحمدُ وأكثَرُ الفقهاءِ رضي الله عنهما أجمعين. قَالَ اللهُ تَعَالَى: ﴿وَتَعَاوَنُوا عَلَى البِرِّ وَالتَّقْوَى﴾ [المائدة: ٢٠] والآيات في معنى مَا ذكرته كثيرة معلومة.
Know that mixing with people in the way I have mentioned is the preferred way, on which the Messenger of Allah (peace and blessings be upon him) and all the other Prophets (Allah's blessings and peace be upon them) were, and likewise the Rightly Guided Caliphs, and after them the Companions and the Successors, and after them the scholars of the Muslims and their best people (were on it). It is the view of most of the Successors and those after them, and it is the position of al-Shafi'i, Ahmad and most of the jurists, may Allah be pleased with them all.
Allah Almighty said: "And help one another in righteousness and piety." (Surah al-Ma'idah: 2)
The verses with the meaning of what I have mentioned are many and well known.