Judge advocate
A judge advocate was an officer of the court who served as a military lawyer and was appointed by the Judge Advocate General. Judge advocates represented their respective military in legal matters and served as advisors in upholding the laws of said military, such as the Starfleet Uniform Code of Justice.
Vulcan Admiral Pasalk served as a judge advocate in the Judge Advocate General's Office on Earth during the mid-23rd century. Captain Marie Batel served under Pasalk. (SNW: "Ad Astra per Aspera", "Among the Lotus Eaters")
Areel Shaw was a lawyer in the judge advocate's office on Starbase 11 in 2267. While there, she prosecuted the court martial of Captain James T. Kirk on the charge of culpable negligence. (TOS: "Court Martial")