Starfleet Security is the branch of the Federation Starfleet responsible for security aboard all Federation starships and at all Federation starbases and outposts. In addition, Starfleet Security is responsible for providing security at all Federation government facilities, such as the Palais de la Concorde. Starfleet Security is responsible for maintaining and enforcing Starfleet regulations, procedures and policies on all Starfleet and affiliated facilities, outposts, and vessels, and is responsible for setting security clearances for all Starfleet and government personnel and facilities. Starfleet Security often works in conjunction with Starfleet Intelligence. (TNG episode: "The Drumhead", et. al.)
Starfleet Security can trace its origins in large part back to United Earth's Military Assault Command Organization. Following the Earth-Romulan War the MACOs were folded into the Federation Starfleet, becoming known as Starfleet Security. Prior to that, United Earth Starfleet Security conducted the investigation into Dr. Phlox's kidnapping by the Klingons. (ENT - Rise of the Federation novel: A Choice of Futures, ENT episode: "Affliction")
A special division of Starfleet Security provides constant security for the President of the United Federation of Planets. Members of the presidential protection division are present with the President at all times, and constantly guard the Château Thelian and the Presidential Office. Typically, Security officers wear standard Starfleet duty uniforms; on special occasions, officers may wear formal wear from their home planets or a Starfleet dress uniform. (ST novel: Articles of the Federation)
In 2379, Starfleet Admirals William Ross, Alynna Nechayev, and Mamoru Nakamura used their authority within Starfleet Command to order all members of Starfleet Security out of the Palais and away from Federation President Min Zife, whom they forced to resign at gunpoint. Subsequently, agents of Section 31 assassinated Zife, his chief of staff, Koll Azernal, and Federation Secretary of Military Intelligence Nelino Quafina. (TNG - A Time to... novel: A Time to Heal)
In 2381, during the administration of Federation President Nanietta Bacco the Starfleet Security detail entrusted with the protection of the President, Château Thelian, and the Presidential Office were replaced with a special unit of the Federation Security Agency known as the Protection Detail (TNG - Cold Equations novel: Silent Weapons, ST - Destiny novel: Mere Mortals). This was most likely done in response to Bacco's discovery of Starfleet's (in actuality, Section 31 via Admiral William Ross') involvement in the forced resignation and assassination of her immediate predecessor, President Min Zife (ST novel: Articles of the Federation).
An entry comparing the life-span of various beings with the shelf life of gold-pressed latinum includes the entry "Lifespan of a Federation hew-mon working for Starfleet Security: Rarely survive beyond the second act break". (DS9 novel: Legends of the Ferengi)