Martial law
Overview: Despite the fact that it has been declared frequently throughout history, martial law is still often described as largely elusive as a legal entity. References to martial law date back to 1628 England, when Sir Matthew Hale described martial law as, "no Law, but something indulged rather than allowed as a Law." Despite being centuries old, this quote remains true in many countries around the world today. Most often, the implementation of martial law arises from necessity rather than legal right, and while some countries have provisions explicitly permitting the use of martial law, many do not. For countries that do not explicitly permit the declaration of martial law, but where martial law has been declared, the legal justification for it is often the common law doctrine of necessity, or some variation of it.

Common law doctrine of necessity and martial law: One legal theory most frequently associated with martial law is the common law doctrine of necessity. While many countries, the United States for example, do not have the explicit constitutional right to declare martial law, scholars often interpret the law of the United States to allow for the implementation of martial law in times of necessity. Countries such as Pakistan have famously implemented this rationale as well.

Use: Martial law can be used by governments to enforce their rule over the public, as seen in multiple countries listed below. Such incidents may occur after a coup d'état (Thailand in 2006 and 2014, and Egypt in 2013); when threatened by popular protest (China, Tiananmen Square protests of 1989); to suppress political opposition (martial law in Poland in 1981); or to stabilize insurrections or perceived insurrections. Martial law may be declared in cases of major natural disasters; however, most countries use a different legal construct, such as a state of emergency.
Martial law has also been imposed during conflicts, and in cases of occupations, where the absence of any other civil government provides for an unstable population. Examples of this form of military rule include post World War II reconstruction in Germany and Japan, the recovery and reconstruction of the former Confederate States of America during Reconstruction Era in the United States of America following the American Civil War, and German occupation of northern France between 1871 and 1873 after the Treaty of Frankfurt ended the Franco-Prussian War.
Typically, the imposition of martial law accompanies curfews; the suspension of civil law, civil rights, and habeas corpus; and the application or extension of military law or military justice to civilians. Civilians defying martial law may be subjected to military tribunal (court-martial).

By country/region: 

Armenia: During the 2020 Nagorno-Karabakh war, Armenian prime minister Nikol Pashinyan declared martial law.

Australia: The Black War was a period of violent conflict between British colonists and Aboriginal Australians in Tasmania from the mid-1820s to 1832. With an escalation of violence in the late 1820s, Lieutenant-Governor George Arthur declared martial law in November 1828—effectively providing legal immunity for killing Aboriginal people. It would remain in force for more than three years, the longest period of martial law in the history of the British colonies on the Australian continent. As of 2023, martial law has never been declared since federation in 1901.

Azerbaijan: During the 2020 Nagorno-Karabakh war, Azerbaijani president Ilham Aliyev declared martial law.

Bahrain: In 2011, King Hamad bin Isa Al Khalifa declared martial law during an anti-government uprising, granting authority to the police and military to crack down on protesters. It was lifted on 1 June amid a continuing crackdown on the uprising.

Brunei: Brunei has been under martial law since a rebellion occurred on 8 December 1962 and was put down by British troops from Singapore. The Sultan of Brunei, Sultan Haji Hassanal Bolkiah Mu'izzaddin Waddaulah, is presently the head of state and also the Minister of Defense and Commander in Chief of Royal Brunei Armed Forces.

Canada: The War Measures Act was a Parliament of Canada statute that allowed the government to assume sweeping emergency powers, stopping short of martial law, i.e., the military did not administer justice, which remained in the hands of the courts. The act was invoked three times: During World War I, World War II, and the October Crisis of 1970. In 1988, the War Measures Act was replaced by the Emergencies Act, which saw its first invocation in February 2022 amidst the Freedom Convoy protests.
During the colonial era, martial law was proclaimed and applied in the territory of the Province of Quebec during the invasion of Canada by the Continental Army during the American Revolutionary War in 1775–1776. It was also applied twice in the Province of Lower Canada during the 1837–1838 insurrections. On December 5, following the events of November 1837, martial law was proclaimed in the district of Montreal by Governor Gosford, without the support of the Legislative Assembly of Lower Canada. It was imposed until April 27, 1838. Martial law was proclaimed a second time on November 4, 1838, this time by acting Governor John Colborne, and was applied in the district of Montreal until August 24, 1839.

China: In China, martial law in the Beiyang government could be dated back to the final year of the Qing dynasty. The outline of a 1908 draft constitution—modeled on Japan's Meiji Constitution—included provisions for martial law. The Provisional Government of the Republic of China promulgated the Provisional Constitution in March 1911, which authorized the President to declare martial law in times of emergency. The Martial Law Declaration Act were issued by the Nationalist Government later in 1920s and amended in 1940s. Following World War II, the island of Taiwan came back to China's control given the impending withdrawal of Japanese forces and colonial government. Martial law was declared first in 1947 in Taiwan Province after the February 28 incident, then again in 1949 as the Chinese Civil War was also raging across the country despite the democracy promised in the Constitution of the Republic of China (the central government refused to implement the constitution on Taiwan until after 1949).
After the Nationalist-led central government of China lost control of the mainland to the Chinese Communist Party and retreated to Taiwan in 1949, the perceived need to suppress Communist activities in Taiwan was utilised as a rationale for not lifting martial law until thirty-eight years later in 1987, just prior to the death of then President Chiang Ching-kuo.  Taiwan's period of martial law was one of the longest in modern history, after that of Syria (1967–2011).
Martial law was imposed in Beijing in 1989 following the Tiananmen Square protests of 1989 by the Communist-ruled government on mainland China.

Egypt: In Egypt, states of emergency were in effect almost continuously from 1967 to 2021. A state of emergency gives military courts the power to try civilians and allows the government to detain for renewable 45-day periods and without court orders anyone deemed to be threatening state security. Public demonstrations are banned under the legislation.
During Hosni Mubarak's presidency, parliament had renewed emergency laws every three years since they were imposed. The legislation was extended in 2003 and were due to expire at the end of May 2006; plans were in place to replace it with new anti-terrorism laws. After the Dahab bombings in April of that year, it was renewed for another two years. In May 2008 there was a further extension to June 2010. In May 2010, the state of emergency was further extended, albeit with a promise from the government to be applied only to 'Terrorism and Drugs' suspects. On 10 February 2011, during the uprising against his rule, Mubarak promised the deletion of the relevant constitutional article regarding the emergency law in an attempt to please the mass number of protesters that demanded him to resign. The following day, he stepped down and handed control of the country to the Supreme Council of the Armed Forces. It meant that the presidential executive powers, the parliamentary legislative powers and the judicial powers all transferred directly to the military system which may delegate powers back and forth to any civilian institution within its territory.
The military issued in its third announcement the "end of the State of Emergency as soon as order is restored in Egypt". Before martial law, the Egyptian parliament under the constitution had the civilian power to declare a state of emergency. When in martial law, the military gained all powers of the state, including to dissolve the parliament and suspend the constitution as it did in its fifth announcement. Under martial law, the only legal framework within the Egyptian territory was the numbered announcements from the military. These announcements could for instance order any civilian laws to come back into force. The military announcements (communiqués) were the de facto only constitution and legal framework for the Egyptian territory. It meant that all affairs of the state were bound by the Geneva Conventions.
Under the current president Abdel Fattah el-Sisi, a series of constitutional amendments passed in 2019 granted the military authority to intervene in national politics to "preserve the constitution and democracy, protect the basic principles of the state and its civil nature, and protect the people's rights and freedoms". The armed forces were separately granted policing responsibilities to arrest civilians and "protect public and vital facilities".