The legal branch of Starfleet, which conducts hearings, courts-martial and other proceedings under Starfleet law.
The Starfleet Judge Advocate General's office, usually called JAG, handles the legal affairs of Starfleet, from courts-martial to hearings on the conduct and rights of its officers. Starfleet trials such as the original series episode Court Martial, in which James T. Kirk is cleared of negligence, show the service's legal system at work.
In The Measure of a Man, JAG officer Phillipa Louvois presides over a hearing on whether Data is Starfleet property or a sentient being with rights. In Rules of Engagement on Deep Space Nine, a JAG hearing considers a Klingon demand to extradite Worf.