Bhagavad Gita

ನಾಸ್ತಿ ಬುದ್ಧಿರಯುಕ್ತಸ್ಯ ನಚಾಯುಕ್ತಸ್ಯ ಭಾವನಾ ।
ನ ಚಾಭಾವಯತಃ ಶಾಂತಿರಶಾಂತಸ್ಯ ಕುತಃ ಸುಖಮ್ ॥೬೬॥
nāsti buddhirayuktasya nacāyuktasya bhāvanā |
na cābhāvayataḥ śāṃtiraśāṃtasya kutaḥ sukham ||66||

Gist of the sloka:
One who has not controlled the mind, will never have clear mind/clarity. He will be unable to perform Dhyana and without Dhyana [will be unable to focus on Lord] there is no mukthi. Without mukthi where is peace?
To have happiness one needs peace. With a disturbed mind, one cannot reach the Lord. One whose mind is not tuned to Lord, how can he obtain real knowledge. Such a person will not have clear mindset. They will never be able to think clearly. Without thinking with concentration, he will be unable to realize the truth. They will be unable to meditate. Without ability to meditate on the Lord, mukthi is impossible.
Dhyana means thinking about the Lord in a concentrated manner without distraction. Without concentrated effort, we will be unable to understand the object clearly, in its fullest extent. It is mentioned as ‘bhavana’ here in the verse. With the in-depth understanding of the object, we will be unable to realize it in full. The object here being Lord and knowledge about Him.
Shanthi means ‘peace’ and in the larger context means peace forever or Mukthi. One should therefore control the senses, tune the mind to think with intense concentration on the Lord and his qualities, realize the truth and then achieve peace [with peace happiness] forever or mukthi.
When we turn our attention inwards away from the distracting world, we will be able to go deeper into the knowledge and realize the truths.
This is the, first self and later God realization happens. Which then leads to mukthi or permanent peace and happiness.