The environmental problems today are, in part, due to the attitude that spread during the Industrial Revolution that human beings have the God-given right to do whatever they want to the non-human world and use it as a product or resource. This was worsened by the push in capitalism to push people to consume beyond their needs. We know now today that this is not sustainable, although many of our livelihoods are stuck in this model.
In contrast, the Qur'an treats the natural universe as aware and part of a whole, rather than as a dead resource to be used however humans will. For instance, it says that everything in creation praises Allah, it speaks of the concerns of ants and the lives of bees, birds have opinions, and the earth is made to speak (when it is offered the "trust" before human beings, and at the end of time).
When the Qur'an says that Allah made the human being a khalifah, this is understood to mean that the human being has the responsibility to be a responsible caretaker, not an overlord, over creation. We may consume plants and animals and use the treasures of the earth and the sea, but not wastefully or wantonly, since the wasteful are the "brothers of the shayatin".
This holistic view characterises many pre-modern human socities (and some modern ones). Reviving this view can help to lead to a better way to treat the natural environment.
As mentioned, the Qur'an also tells us not to waste and calls the wasteful the "brothers of the shayateen". This is a very strong statement, and suggests that wasteful overconsumption is a form of evil or delusion (as Shaytan's primary tool is deception). Today many of us are bombarded by the delusions of mass advertising and mass media encouraging overconsumption or unhealthy consumption.
The Qur'an also tells us to eat and drink of the good things of the earth. This does not include many of the factory processed foods or unhealthy food production, such as Coca cola, which are some of the worst offenders in terms of packaging, production cost, etc. It also does not include abusive or destructive practices such as factory farming done unsustainably.
These verses are also taken to include our responsiblity environmentally:
* “And do not commit abuse on the earth, spreading corruption.” (Qur’an, 2:60)
* “And do not desire corruption in the land. Indeed, God does not like corruptors.” (Qur’an 28:77).
* "Corruption has appeared on the sea and land due to what has transpired by the hands of men" (Qur'an 30:41).
Here, fasad (corruption) is taken to include environmental destruction. Especially in the last verse, this understanding seems apt, because of what is happening that is our fault, especially when it is combined with other forms of corruption such as political corruption and corporate greed.
A number of hadith directly or indirectly point to the importance of looking after the environment. There are some in this article. These are from a Sunni provenance, although this isn't an issue where there is a sectarian difference. https://www.ecomena.org/islam-and-environmental-protection/
With all of this, one might ask why Muslims are not at the forefront of environmental protection. Some are; there are certainly Muslims working for sustainable farming practices, reduced waste, eco-friendly mosques, fighting pollution, and the like. However, the economic and political circumstances of Muslim-majority countries classified as "developing nations" has made this extremely different in the face of the modern socio-economic structure (especially when there are other considerations such as war).
Some further resources:
* Shaykh Jaffer Ladak has a number of speeches on the subject of environment and Islam and some other materials and would be a good resource.
* A conference paper published by Makbul Rahim on this environmental practices at Khoja Ithna Ashari Shia mosques and presented at The Islamic College in London.
* Seyyed Mostafa Damad, "A Philosophical Solution For The Environmental Crisis", in Journal of Shi‘a Islamic Studies, vol. 1, no. 1 (2008)
* And, of course, many others; for instance, if you search Google Scholar.
One should move as soon as they are able, as per Qur'an 4:97-99 and the example of the Prophet (S) and the early Muslims (who made the first migration to Ethiopia and the second migration to Medina).
Sincere believers along history till now face challenges opposing them to practice their faith, but they always stay strong and never give up their religious duties. The patience (Sabr) from faith is like the head from the body as the Hadeeth says.
Patience and wisdom is the way to tackle the challenges with strong faith that Allah (SWT) never leaves His servants.
Insofar as it is possible, it is good to try to adjust your environment to avoid triggers (for instance, avoiding online or television material with indecent content, looking away from certain advertisements or behaviour outside). I know that this can be difficult in some places which have become quite explicit! It is related from the Prophet (S) - and I am sure you have heard this - that if you lower your gaze, you will see wonders.
As for thoughts, to some degree we have control over our thoughts, you can try to change what you are thinking about and focus on something else if you find your thoughts wandering.
If you are a male and really struggling with this, fasting has been recommended too and may be helpful (as long as you do not do it to excess).
Anyway this is part of being a normal human being, all you can do is your best and be compassionate with yourself while trying to navigate the straight path.