Section 31

Origins
Section 31 was an unofficial and unsanctioned intelligence agency working within Starfleet and the United Federation of Planets. Section 31 determined its own agenda, seeking out and eliminating threats to the Federation before they became threats, and answered only to themselves.

Section 31 justified their actions by pointing to Article 14, Section 31 of the original Starfleet charter, which allowed for the creation of an independent investigative branch of Starfleet Intelligence that held non-specific discretionary power over non-specific matters. (Star Trek: Enterprise episode Divergence, S31 Cloak)

Malcolm Reed of the Enterprise (NX-01) served as an operative of Section 31 early in his career under a man named Harris. Despite Reed's resignation from the "bureau", Harris would later attempt to coerce Reed into returning to 31's service.

23rd Century
In the early 2260's, Section 31 recruited twenty-year Starfleet security officer Peter Lawrence into their ranks. Lawrence, who had been dreading the thought of retirement or a desk job, jumped at the chance to continue to serve.

Working for Section 31, Lawrence found that he had a talent for investigative matters, but became uncomfortable with the secrecy and paranoia that fueled every action of the agency.

Lawrence left Section 31 after he investigated attorney Samuel T. Cogley at their behest. Cogley seemed to have an agenda that was at odds with Section 31s, and Lawrence was assigned to uncover that agenda.

Cogley had no agenda, simply a firm conviction that all being were entitled to the best possible defense in a court of law. Lawrence, believing Cogley to be the single most honorable man that he had ever met, resigned from Starfleet to work for Cogley, and left Section 31 behind.

Section 31 attempted coerce Lawrence back into their service without success. How Lawrence managed to survive the encounter with both life and reputation intact is unknown. ((Star Trek: The Original series novel, The Case of the Colonist's Corpse)

Admiral Cartwright
in 2268, Captain James T. Kirk of the USS Enterprise (NCC-1701) was assigned by Rear Admiral Cartwright to retrieve a Romulan cloaking device at all costs. A mission that was successful. Several months later evidence linking the "liberated" cloaking device to the destruction of the USS Sphinx with all hands was uncovered by the crew of the Enterprise. Inquiries to Cartwright proved a dead-end, and Captain Kirk decided to investigate further, uncovering a scientific cabal that were trying to create a stable Omega Molecule, and eventually led Kirk to the knowledge of Section 31's existence.

The scientists unsuccessful attempt at creating a stable Omega Molecule resulted in the destruction of the subspace layer for several cubic lightyears. This event led Starfleet to impose the Omega Directive, barring all omega research.

Two months later on a remote planet, Kirk met with Captains Phil Wattersonand Nick Silver, and Commodores Aaron Stone and Jose Mendez to inform them of his discoveries and suspicions.

They formed a secret cabal whose purpose was to oppose Section 31 wherever they reared their head. The cabal, which took in new members in the years thast followed, still existed in the year 2376 when Commander Elias Vaughn recruited Dr. Julian Bashir into its ranks. (S31 novels: Cloak, Abyss)

In 2293 Admiral Cartwright was part of a conspiracy to assassinate Klingon Chancellor Gorkon and Federation President Ra-ghoratreii in collusion with Klingon General Chang and Romulan ambassador Nanclus. Given Cartwright's prior history with Section 31, it can be speculated this was also a Section 31 operation. In later years, Section 31 would prove to have few qualms over assassinating a Federation President. (movie: Star Trek VI: The Undiscovered Country)