Judge Advocate General's Corps, also known as JAG or JAG Corps, refers to the legal branch or specialty of a military concerned with military justice and military law. Officers serving in a JAG Corps are typically called Judge Advocates. Only the chief attorney within each branch is referred to as the "Judge Advocate General"; however, individual JAG Corps officers are colloquially known as JAGs.

Judge Advocates serve primarily as legal advisors to the command to which they are assigned. In this function, they can also serve as the personal legal advisor to their commander. Their advice may cover a wide range of issues dealing with administrative law, government contracting, civilian and military personnel law, law of war and international relations, environmental law, etc. They also serve as prosecutors for the military when conducting courts-martial. In the United States military, they are charged with both the defense and prosecution of military law as provided in the Uniform Code of Military Justice. Highly experienced officers of the JAG Corps often serve as military judges in courts-martial and courts of inquiry.

The Uniform Code of Military Justice (UCMJ), is the primary legal code through which all internal military justice matters of the United States are governed. The UCMJ applies to all members of the Military of the United States, including military retirees as well as members of other federal uniformed services (such as NOAA Corps and the Public Health Service Commissioned Corps) when attached to the military. The UCMJ was created by an act of the United States Congress in 1951 in order to establish relatively consistent systems of military justice in all branches of the nation's armed forces. However, in cases involving very minor disciplinary infractions, each service has somewhat differing procedures. Such cases are governed by UCMJ Article 15 and are called non-judicial punishment, Captain's Mast (Navy), or Office Hours (Marines).

In addition to the Uniform Code of Military Justice, personnel are subject to the terms of the Constitution, other federal laws, and individual state laws where applicable (e.g., whenever the service member is in the United States, unless on a military base with exclusive federal jurisdiction). When a violation of the UCMJ occurs, the matter is handled by the command of the servicemember. When a violation of a federal or state law occurs, the matter may be handled by local state or federal authorities.

The forum through which criminal cases are tried in the United States' armed forces is the court-martial. This term also applies to the panel of military officers selected to serve as the finders of fact or "jury". In other words, they fulfil the role of a civilian jury in trying criminal cases. The Uniform Code of Military Justice outlines three distinct types of courts-martial.

Officers detailed to the court are defense counsel, trial counsel (prosecutor), and military judge

Special Court-Martial panel comprises three or more members, at least one third of whom are enlisted if requested by an enlisted accused

Accused service member may request trial by judge alone in lieu of trial by a panel of members

Regardless of what crime is charged at a Special Court-Martial, the maximum sentence that can be adjudged is 12 months confinement, forfeiture of two-thirds pay for 12 months, reduction in rank, bad conduct discharge, and a fine

The Uniform Code of Military Justice provides for several tiers of appeal. All cases are reviewed by the commander convening the court (the convening authority) who, as a matter of command prerogative, may approve, disapprove, or modify the findings and/or sentence. The commander may not approve a finding of guilty for an offense of which the accused was acquitted nor increase the sentence adjudged. A convicted service member may submit a request for leniency to the convening authority prior to the convening authority's approval of the court-martial sentence.

Each military service has a Court of Criminal Appeals, which is composed of panels of three appellate military judges:

These courts review all cases in which the approved sentence includes death, a punitive discharge, or confinement for at least a year, and all cases referred to it by the service Judge Advocate General. The court of criminal appeals "may affirm only such findings of guilty and the sentence or such part of the sentence, as it finds correct in law and fact and determines, on the basis of the entire record, should be approved. In considering the record, it may weigh the evidence, judge the credibility of witnesses, and determine controverted questions of fact, recognizing that the trial court saw and heard the witnesses". Article 66(c), UCMJ.

Cases not meeting the criteria for review by the service courts of criminal appeals are reviewed in the office of the service Judge Advocate General. Article 69, UCMJ. A death sentence "may not be executed until approved by the President. In such a case, the President may commute, remit, or suspend the sentence, or any part thereof, as he sees fit. That part of the sentence providing for death may not be suspended". Article 71(a), UCMJ.

In addition to being licensedattorneys in any state or territory of the United States, all military attorneys undergo specialized training to qualify as judge advocates, allowing them to act as trial or defense counsel at military courts-martial. Specialized training takes place at one of three military law centers: