Judge Advocate General
From Hidden Frontier
A Judge Advocate General (often shortened to JAG) within Starfleet is an officer who advises Starfleet on and administers courts-martial, as well as oversees other Starfleet legal matters and personnel. Legal counsel within Starfleet report into the senior JAG as part of the department known as the Judge Advocate General's Office (or simply the "Judge Advocate's Office").
