The Attorney General of the United Federation of Planets was the chief legal officer and law enforcement officer of the United Federation of Planets.
History and specifics[]
In 2384, former Starfleet Judge Advocate General Captain Phillipa Louvois became the Attorney General for the Federation. The next year she had to deal not only with Baras Rodirya, but other civilians and Starfleet personnel who conspired with Baras to take over the Federation government. (TNG novel: Available Light, ST - The Fall novel: Peaceable Kingdoms)
2386 was an even busier year for the Attorney General's office after the deletion of the Uraei surveillance program and the exposure of Section 31 to the general public. It was decided early on that the Attorney General's office would take the lead in investigations, and criminally prosecutions if necessary, for both civilian and Starfleet agents of the rogue intelligence agency. (TNG novel: Available Light)