Praise be to Allah.
It is proven in the hadeeth (narration) of Jaabir (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: "Madeenah is like a bellows that eliminates the dross and enhances the good elements."
Narrated by al-Bukhaari, 6785; and Muslim, 1383.
Al-Nawawi said: What this means is that those whose faith is contaminated will leave Madeenah and those whose faith is sincere will stay there. It is proven in the hadeeth of Anas ibn Maalik (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: "There is no land that the Dajjaal (imposter) will not enter, apart from Makkah and Madeenah. At every path of them there are angels in ranks, guarding them. Madeenah will be shaken three times with its inhabitants, and Allaah will bring out of it every kaafir disbeliever and hypocrite." Narrated by al-Bukhaari, 1782; and Muslim, 160.
And it was narrated from Abu Hurayrah (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) said: "There will come a time when a man will say to his cousin and relatives, ‘Come to an easy life, come to an easy life,’ but Madeenah will be better for them if only they knew. By the One in Whose hand Hand is my soul, no one leaves Madeenah because he prefers to lives elsewhere but Allaah will replace him with someone who is better. Madeenah is like a bellows that brings out the dross. The Hour will not begin until Madeenah is cleansed of its evil people like the bellows cleanses iron of dross."
Narrated by Muslim, 1381.
These ahaadeeth (narrations) explain that no evil will remain in Madeenah and that it is always cleansed of its evil; the Dajjaal will never enter it, and it is a better for those who leave it for other places.
But this does not necessarily mean that those who leave Madeenah have been tempted by the Shaytaan. Allaah has created the causes of remaining steadfast in adhering to truth and guidance, just as He has created the causes of going astray. Everything is in the hand Hand of Allaah, from beginning to end, and Allaah creates causes for everything.
Some of the causes and means of remaining steadfast in adhering to guidance are as follows:
1- Remembering Allaah a great deal (dhikr), praying and reading Qur’aan
2- Always making du’aa’ and asking Allaah to make one steadfast
3- Keeping company with good people and sitting with righteous people
4- Keeping away from situations and places that provoke desires and cause temptation
5- Arming oneself with Islamic knowledge
6- Calling people to Allaah (d’a’wah) and sacrificing that which is most precious for the sake of Allaah
7- You should read the books Ways to Steadfast Faith and the book , 33 Ways of Developing Khushoo’ in Salaah on this website (under Useful Material > Books).
May Allaah help you to do all that is good.