Luther Sloan is an agent with Section 31.
Section 31 is a ultra-clandestine agency inside Starfleet.
Starfleet, of course, is the exploratory and defensive military arm of the United Federation of Planets (UFP), a collection of various sovereign planets joined together for mutual protection and advancement; its two charter member worlds being Earth and Vulcan. While from its inception, the Federation was meant to be an instrument of peace and harmony while at the same time reaching deeper into the unknown space to learn and grow, it was felt by some that there would always be unseen threats to the stability of the organization. Most would come from outside, such as the Klingon and Romulan Empires, but some would originate from inside with some unscrupulous individuals and groups wanting to advance their own agendas.
When Starfleet was first formally established by way of the Starfleet Charter at the end of the 2130s, Article 14, Section 31 discussed the need on occasion to bend or suspend the Starfleet regulations in times of extraordinary threat. To that end, a very secretive subgroup inside what would become Starfleet Intelligence was created using as its name that little talked about part of the regulation.
The first recorded acknowledgement of the group comes when on the facility known as Deep Space Nine, its resident doctor, a man named Bashir who is later discovered to be a genetically enhanced individual in violation of Federation law, is suspected further of being under the control of the Dominion (a very nasty and dangerous race from the Gamma Quadrant). His arrest and interrogation is conducted by a team dressed in black uniform who would eventually identify themselves. That team's on-site leader, Luther Sloan, is the first to mention it with, "Let's just say I belong to another branch of Starfleet Intelligence. Our official designation is Section 31. We keep a low profile. Works out better that way for all concerned".
Sloan is an interesting man as we never really know for sure if he should be considered a good guy or a bad guy. Certainly his stated motives put him in the first group but his methods to achieve those goals are decidedly in the latter. We learn a good deal about Sloan in the brief time we had to observe him, most of which is contained in the fandom site Memory Alpha. "According to 'Deputy Director' Sloan, he wanted to be a medical doctor in his youth" but for reasons not explained, he went a different route and ended up in Starfleet Intelligence. Exactly when he made the move internally to Section 31 is not stated but we are told "he was glad to see his son enter Starfleet ... Unfortunately, during the Dominion War his son's convoy dropped out of warp to rendezvous with a Klingon Bird-of-Prey, only to find three Dominion attack ships waiting for them instead. He was killed in the subsequent battle". Whether Sloan's methods took a dark side at that point or was already firmly in place is conjecture but there is no doubt that with his son's death, he is not changing.
"Despite his determination, Sloan's actions often weighed heavily on his conscience. He was unable to sleep at night, though he took comfort in knowing that citizens of the Federation were able to do so. Ultimately, he died wishing he could apologize for cheating his family out of being in his life - and for cheating himself. Because he had spent his life erasing any trace of his actions, it was as if he had never existed."