Opinio juris sive necessitatis ("an opinion of law or necessity") or simply opinio juris ("an opinion of law") is the belief that an action was carried out as a legal obligation. This is in contrast to an action resulting from cognitive reaction or behaviors habitual to an individual. This term is frequently used in legal proceedings such as a defense for a case.
Opinio juris is the subjective element of custom as a source of law, both domestic and international, as it refers to beliefs. The other element is state practice, which is more objective as it is readily discernible. To qualify as state practice, the acts must be consistent and general international practice.
A situation where opinio juris would be feasible is a case concerning self-defense. A condition must be met where the usage of force is limited to the situation at hand. The act of striking an attacker may be done with legal justification; however, legal territory limits the acceptability of such a claim. Even in this case, the usage of force must be acceptable to the conditions of the environment, the attacker, and the physical conditions of the people involved, as well as any weapons or tools used.
In international law, opinio juris is the subjective element used to judge whether the practice of a state is due to a belief that it is legally obliged to do a particular act. When opinio juris exists and is consistent with nearly all state practice, customary international law emerges. Opinio juris essentially means that states must act in compliance with the norm not merely out of convenience, habit, coincidence, or political expediency, but rather out of a sense of legal obligation. [1] Article 38(1)(b) of the Statute of the International Court of Justice accepts "international custom" as a source of law, but only where this custom is 1) “evidence of a general practice,” (the objective component) (2) "accepted as law." (the opinio juris or subjective component) Thus, for example, while it may be observed that heads of state virtually always shake hands when they first meet, it is highly unlikely that they do so because they believe that a rule of international law requires it. On the other hand, a state would almost certainly expect some form of legal repercussions if it were to prosecute a foreign ambassador without the consent of his or her home state, and in this sense opinio juris does exist for the international law rule of diplomatic immunity.