The rules of jus cogens (also known as peremptory norm) are derived from the customary international law,  and it is a rule or principle which is so fundamental that it binds all states and does not allow any exceptions.  They are ‘accepted and recognized by the international community of States as a whole … which can be modified only by a subsequent norm of general international law having the same character’.  Article 53 of the Vienna Convention on the Law of Treaties (VCLT)1969 states that, ‘a treaty is void if, at the time of its conclusion, it conflicts with a peremptory norm of general international law’.  Article 64 of the VCLT 1969 further enhances its importance by giving it retrospective effect – existing treaty which is in conflict becomes void and is terminated.
On the same note, natural law also played a prominent role in the development of jus cogens in international law.  However, Hasmath stated that it places foundations of jus cogens on shaky grounds,  as jus cogens norms are essentially a social construction. 
The concept of jus cogens was said to be popularised by Verdross.  He defined it as the ‘ethical minimum recognized by all the states of the international community’,  which includes the obligation to undertake certain ‘moral task’, such as ‘maintenance of law and order within states, defense against external attacks, care for the bodily and spiritual welfare of citizens at home, [and] protection of citizens abroad’.  It, as pointed out by Lauterpacht, also operates as a concept superior to both customary international law and treaty.  Although this concept is important, the International Law Commission remarked that ‘there is no simple criterion by which to identify a general rule of international law as having the character of jus cogens’. 
Also, as noted by Yasseen, a State or a minority number of States which refuse to accept the peremptory character of the rule, the acceptance and recognition as jus cogens by all other States would not be affected, because a mere majority would suffice,  and the minority States will not be able to opt out for long as they will loss certain privillages. 
Nevertheless, the rules of jus cogens have several important elements in the international legal context. Special Rapporteur R. Ago stated that, the rules of jus cogens which made of norms laying down international obligation ‘so essential for the protection of fundamental interest of the international community that [their] breach [was] recognized as a crime by that community as a whole’ (emphasis added),  and it has now been crystallised in Article 40 of the Draft Articles on Responsibility of States for Internationally Wrongful Acts 2001. The use of force against the other territory was held by the International Court of Justice in Nicaragua v USA as wrongful act under the jus cogens rules.  Slave trade, genocide, racial discrimination and apartheid are also categorised as wrongful acts within the contemporary of jus cogens rules. 
Moreover, as noted by Cassese, jus cogens has meta-legal effect,  where he cited the case of Prosecutor v Anto Furundzija,  which, the court ruled that jus cogens has a ‘deterrent effect, in that it signals to all members of the international community and the individuals over whom they wield authority that the prohibition… is an absolute value from which nobody must deviate’.  Also, theSwiss Constitution of 18 April 1999, Article 139(2), states that if the law of nation which violates the international law, the Federal Assembly shall declare it invalid, whether as a whole or in part.
In addition, it can be said that jus cogens is there to protect and uphold human dignity and rights. Criddle and Fox-Decent stated that the jus cogens rules will trigger the fiduciary principle,  where any entity and States that ‘assumes unilateral administrative power over individuals bears a fiduciary obligation to honor the basic demands of dignity, which includes the peremptory norms of international jus cogens’.  As mentioned above, any activities or treaties carried out by the States or international organisations which offended human dignity and rights are contrary to the concept of jus cogens, will be considered null and void.
Jus cogens has also an effect on the doctrine of state immunity. The general rule is that all States have the immunity from being sued by the others. This can be clearly seen in Al-Adsani v Kuwait,  where the claimant brought an action for damages in tort against the Kuwait government, claiming that he has been tortured by the officials of Kuwait. It was held that the government of Kuwait was entitled to immunity from being sued. This has been affirmed by the European Court on Human Rights.  But the minority judges in the European Court on Human Rights stated that ‘the jus cogens nature of the prohibition of torture entails that a State allegedly violating it cannot invoke hierarchically lower rules… to avoid the consequences of the illegality of its actions’,  and stated that Kuwait could not ‘hide behind the rules on State immunity to avoid proceedings for a serious claim of torture’.  Caplan pointed out that state immunity is not jus cogens, it ranks lower in the hierarchy of international law norms, and therefore can be overcome when a jus cogens norm is at stake, so that human rights victims is able to seek legal redress.  This can be clearly seen in R v Bow Street Metropolitan Stipendiary Magistrate and others, ex parte Pinochet Ugarte (No. 3),  the House of Lords ruled that when there is an issue of crime against humanity, the State Immunity Act 1978 shall be inferior to the rules of jus cogens.
In conclusion, jus cogens rules are derived from the customary international law and natural law. Although jus cogens come with its own sets of problems, it still plays a vital role in international law as discussed above.