It is reported that Al-Ḥasan Al-Baṣrī – Allāh have mercy on him – said:

The intelligent person’s tongue is behind his heart: when he wants to speak, he first thinks. If [his words] will be in his favor, he says them, and if they will be against him, he does not speak. And the ignorant person’s heart is behind his tongue: when he merely thinks of saying something, he says it, whether it is for or against him.

Abū Bakr Al-Daynūrī, Al-Mujālasah wa Jawāhir Al-‘Ilm article 2049.