What is the Uniform Code of Military Justice (UCMJ)?

The Uniform Code of Military Justice (UCMJ) establishes the rules for the independent operation, control, and command of the US military’s four branches. Basically, military law exists for the regulation of military members, the preservation of justice and the maintenance of order. The United States military is well-organized and positioned to be of service to the (civilian) President of the United States in part thanks to military law - and especially the UCMJ.

Details - UCMJ

There are several different ways the UCMJ and military authority can be enforced: military commissions, provost courts, courts-martial, commanding officers and officers in charge, and courts of inquiry (the latter can be established and regulated by the different secretaries of the military branches). There are also rules for military conduct for each of the military departments, covering each of the military branches. The Coast Guard, which is a military branch in Homeland Security, has a Personnel Manual with conduct rules, but is also bound by the UCMJ.

Military law applies not only under wartime conditions, but also in times of peace. Though it is a U.S. law, it is one of the few that explicitly can apply beyond U.S. borders (depending on when and where the military is operating). The UCMJ can even be enforced in an occupied area, especially insofar as it dictates rules for treating a civilian population under occupation (e.g. - Japan in WW2, Iraq, etc). There are even instances where the UCMJ’s military rules describe how to follow municipal laws and how and when the National Guard should be deployed in natural disasters.

Source of UCMJ Authority

Because the UCMJ has a broad application, international laws and treaties sometimes become part of the code. However, from the perspective of maintaining effective military forces, the important thing is sourcing the UCMJ from our most valued civilian sources. The US Constitution gives some powers to Congress to establish laws and regulate our military operations, and other "executive" powers to the president to utilize the military in accordance with national security needs.

You can view many of the current rules of military law in the National Security Act of 1947, and the UCMJ Act of 1951 (Title 10, Chapter 47 of the United States Code).