A security agency is a governmental organization that conducts intelligence activities for the internal security of a nation. They are the domestic cousins of foreign intelligence agencies, and typically conduct counterintelligence to thwart other countries' foreign intelligence efforts. For example, the United States Federal Bureau of Investigation (FBI) is the internal intelligence, security and law enforcement agency, while the Central Intelligence Agency (CIA) is an external intelligence service, which deals primarily with intelligence collection overseas. A similar relationship exists in Britain between MI5 and MI6.
The distinction, or overlap, between security agencies, national police, and gendarmerie organizations varies by country. For example, in the United States, one organization, the FBI, is a national police, an internal security agency, and a counterintelligence agency. In other countries, separate agencies exist, although the nature of their work causes them to interact. For example, in France, the Police nationale and the Gendarmerie nationale both handle policing duties, and the Direction centrale du renseignement intérieur handles counterintelligence.
Likewise, the distinction, or overlap, between military and civilian security agencies varies between countries. In the United States, the FBI and CIA are civilian agencies, although they have various paramilitary traits and have professional relationships with the U.S.'s military intelligence organizations. In many countries all intelligence efforts answer to the military, whether by official design or at least on a de facto basis. Countries where various military and civilian agencies divide responsibilities tend to reorganize their efforts over the decades to force the various agencies to cooperate more effectively, integrating (or at least coordinating) their efforts with some unified directorate. For example, after many years of turf wars, the member agencies of the United States Intelligence Community are now coordinated by the Director of National Intelligence, with the hope to reduce stovepiping of information.
Security agencies frequently have "security", "intelligence" or "service" in their names. Private organizations that provide services similar to a security agency might be called a "security company" or "security service", but those terms can also be used for organizations that have nothing to do with intelligence gathering.