In The Name of Allaah, The Most Merciful, The Bestower of Mercy.
Imaam Ibnul Qayyim [may Allaah have mercy upon him] said:
The basis of all sins – major and minor – are three: the heart’s attachment to other than Allaah, going along with the intense strength of one’s anger and the intense urge of one’s desires. These three affairs constitute shirk, injustice and indecency. Shirk and invoking other than Allaah is the ultimate affair related to the heart’s attachment to other than Allaah, murder is the ultimate affair related to going along with one’s intense anger and fornication is the ultimate affair related to going along with the intense urge of one’s desires. And because this Allaah mentioned the three together in the [following] Aayah:
وَٱلَّذِينَ لَا يَدۡعُونَ مَعَ ٱللَّهِ إِلَـٰهًا ءَاخَرَ وَلَا يَقۡتُلُونَ ٱلنَّفۡسَ ٱلَّتِى حَرَّمَ ٱللَّهُ إِلَّا بِٱلۡحَقِّ وَلَا يَزۡنُونَ
And those who invoke not any other ilah (god) along with Allah, nor kill such life as Allah has forbidden, except for just cause, nor commit illegal sexual intercourse. [Surah Al-Furqaan. Aayah 68]
These three affairs invite to one another – Shirk inevitably leads to injustice and indecency, just as Tawheed [sound Islamic Monotheism] and Ikhlaas [sincerity] turns a person away from them. Allaah [The Exalted] stated [about Prophet Yusuf (alayhis salaam)]: [ڪَذَٲلِكَ لِنَصۡرِفَ عَنۡهُ ٱلسُّوٓءَ وَٱلۡفَحۡشَآءَۚ إِنَّهُ ۥ مِنۡ عِبَادِنَا ٱلۡمُخۡلَصِينَ – Thus it was, that We might turn away from him evil and indecency. Surely, he was one of Our chosen, guided slaves. [Surah Yusuf. Aayah 24] – Meaning, turned him away from infatuation and illegal sexual intercourse.
Likewise, injustice inevitably leads to Shirk and indecency, because Shirk is the greatest injustice, just as Tawheed is the greatest justice. Justice is a companion of Tawheed and injustice is a companion of Shirk, and this is why Allaah mentioned both together.
As for Tawheed and justice, Allaah said: [شَهِدَ ٱللَّهُ أَنَّهُ ۥ لَآ إِلَـٰهَ إِلَّا هُوَ وَٱلۡمَلَـٰٓٮِٕكَةُ وَأُوْلُواْ ٱلۡعِلۡمِ قَآٮِٕمَۢا بِٱلۡقِسۡطِ – Allah bears witness that Laa ilaaha illaa Huwa (none has the right to be worshipped but He), and the angels, and those having knowledge (also give this witness); (He is always) maintaining His creation in Justice]. [Surah Aal Imraan. Aayah 18]
As for injustice and Shirk, Allaah said: [إِنَّ ٱلشِّرۡكَ لَظُلۡمٌ عَظِيمٌ۬ – Verily, Shirk is great injustice]. [Surah Luqmaan. Aayah 13]
Indecency leads to Shirk and Injustice, especially when there is a strong desire which cannot be reached except through some type of injustice, such as seeking help through magic and shaytaan. And indeed Allaah mentioned both fornication and Shirk together in the Aayah:
ٱلزَّانِى لَا يَنكِحُ إِلَّا زَانِيَةً أَوۡ مُشۡرِكَةً۬ وَٱلزَّانِيَةُ لَا يَنكِحُهَآ إِلَّا زَانٍ أَوۡ مُشۡرِكٌ۬ۚ وَحُرِّمَ ذَٲلِكَ عَلَى ٱلۡمُؤۡمِنِينَ
The adulterer marries not but an adulteress, or a female polytheist and the adulteress none marries her except an adulterer or a male polytheist [and that means that the man who agrees to marry (have a sexual relation with) a female polytheist, pagan or idolatress) or a prostitute, then surely he is either an adulterer, or a polytheist)]. And the woman who agrees to marry (have a sexual relation with) a male polytheist or an adulterer, then she is either a prostitute or a female polytheist)]. Such a thing is forbidden to the believers [of Islamic Monotheism]. [Surah An-Noor. Aayah 3]
These three affairs [i.e. Shirk, Indecency and Injustice] can either be the cause of one another or inevitably lead to one another. And this is why whenever Tawheed in the heart is weaker and the Shirk in it is greater, it commits more indecency, becomes stronger in its attachment to images and infatuated with them. And what is similar to this is the statement of Allaah:
فَمَآ أُوتِيتُم مِّن شَىۡءٍ۬ فَمَتَـٰعُ ٱلۡحَيَوٰةِ ٱلدُّنۡيَاۖ وَمَا عِندَ ٱللَّهِ خَيۡرٌ۬ وَأَبۡقَىٰ لِلَّذِينَ ءَامَنُواْ وَعَلَىٰ رَبِّہِمۡ يَتَوَكَّلُونَ
وَٱلَّذِينَ يَجۡتَنِبُونَ كَبَـٰٓٮِٕرَ ٱلۡإِثۡمِ وَٱلۡفَوَٲحِشَ وَإِذَا مَا غَضِبُواْ هُمۡ يَغۡفِرُونَ
So whatever you have been given is but a passing enjoyment for this worldly life, but that which is with Allah (Paradise) is better and more lasting for those who believe (in the Oneness of Allah Islamic Monotheism) and put their trust in their Lord (concerning all of their affairs). And those who avoid the greater sins and indecency, and when they are angry, they forgive. [Surah Ash-Shooraa. Aayaat 36-37]
Allaah informed us that what He has with Him is better for the one who believes in Him and relies upon him, and that is Tawheed. Then Allaah said: [وَٱلَّذِينَ يَجۡتَنِبُونَ كَبَـٰٓٮِٕرَ ٱلۡإِثۡمِ وَٱلۡفَوَٲحِشَ – And those who avoid the greater sins and indecency – Meaning, avoid the intense urge towards lowly desires]. Then Allaah said: [وَإِذَا مَا غَضِبُواْ هُمۡ يَغۡفِرُونَ – And when they are angry, they pardon]. This opposes the intense strength of anger; so Allaah mentioned Tawheed, pardon and justice together, and they are that which gathers every good.
An Excerpt from Al-Fawaa’id 131-132. Slightly paraphrased]