Coast guard
History: 

United Kingdom: The predecessor of Britain's modern His Majesty's Coastguard was established in 1809 as the Waterguard, a department of the HM Customs and Excise authority, which was originally devoted to the prevention of smuggling. At the time, due to high UK taxation on liquors such as brandy, as well as tobacco and other luxuries, smuggling of such cargos from places such as France, Belgium, and Holland was an attractive proposition for criminals. The barrels of brandy and other contraband were landed from the ships on England's beaches at night in small boats and later sold for profit, as later depicted in the Doctor Syn series of books by Russell Thorndike. The Coastguard was also responsible for giving assistance to shipwrecks.
Each Waterguard station was issued with a Manby mortar, which had been invented by Captain George William Manby in 1808. The mortar fired a shot with a line attached from the shore to the wrecked ship and was used for many years. This was the origin of the Coastguard's life saving role. In 1821 a committee of inquiry recommended that responsibility for the Preventative Waterguard be transferred to the Board of Customs. The Treasury agreed and (in a memorandum dated 15 January 1822) directed that the preventative services, which consisted of the Preventative Water Guard, cruisers, and riding officers should be placed under the authority of the Board of Customs and in future should be named the "Coastguard". In 1845 the Coastguard was subordinated to the Admiralty.

In 1829 the first UK Coastguard instructions were published and dealt with discipline and directions for carrying out preventative duties. They also stipulated that, when a ship was wrecked, the Coastguard was responsible for taking all possible action to save lives, to take charge of the vessel and to protect property.

United States: In the United States, the United States Coast Guard was created in 1915 by the merger of two other federal agencies. The first, the United States Revenue Cutter Service, founded in 1790 and known until 1894 as the United States Revenue-Marine, was a maritime customs enforcement agency that also assumed a supporting role to the United States Navy in wartime. The second, the United States Life-Saving Service, was formed in 1848 and consisted of life saving crews stationed at points along the United States East Coast. The Coast Guard later absorbed the United States Lighthouse Service in 1939 and the functions of the Bureau of Navigation and Steamboat Inspection via a two-step process in 1942 and 1946.

Role: Among the responsibilities that may be entrusted to a coast guard service are:

search and rescue,
enforcement of maritime law,
safety of vessels,
maintenance of seamarks, and
border control.
During wartime, some national coast guard organisations might have a role as a naval reserve force with responsibilities in harbor defenses, port security, naval counter-intelligence and coastal patrols.
The coast guard may, varying by jurisdiction, be a branch of a country's military, a law enforcement agency, or a search and rescue body. For example, the United States Coast Guard is a specialized military branch with law enforcement authority, whereas the United Kingdom's His Majesty's Coastguard (HMCG) is a civilian organisation whose primary role is search and rescue. Most coast guards operate ships and aircraft including helicopters and seaplanes that are either owned or leased by the agency in order to fulfil their respective roles.
Some coast guards, such as the Irish Coast Guard, have only a very limited law enforcement role, usually in enforcing maritime safety law, such as by inspecting ships docked in their jurisdiction.  In cases where the coast guard is primarily concerned with coordinating rather than executing rescue operations, lifeboats are often provided by civilian voluntary organisations, such as the Royal National Lifeboat Institution in the United Kingdom and Ireland, whilst aircraft may be provided by the countries' armed forces, such as the search and rescue Sea Kings formerly operated by the Royal Air Force and Royal Navy, in addition to any of the HMCG's own helicopters.

Racing stripes: Beginning in 1964 with the United States Coast Guard, many coast guards around the world have adopted high visibility color schemes to differentiate their coast guard vessels from the vessels of their respective navies.  A frequent element is a high contrast "racing stripe" on the outer hull.  While no international agreement exists to adopt it as a uniform marking, the 2009/2010 edition of Jane's Fighting Ships showed 61 nations had adopted some form of this stripe pattern for their coastal patrol and rescue vessels.

List of coast guards by country: The following lists a selected number of Coast Guards around the world, illustrating the varied roles they play in the respective governments and the countries they operate in:

Argentina: The Argentine Naval Prefecture, in Spanish Prefectura Naval Argentina or PNA, is a service of the Argentine Republic's Security Ministry charged with protecting the country's rivers, lakes and maritime territory. It therefore fulfills the functions of other countries' coast guards, and furthermore acts as a gendarmerie force policing navigable rivers and lakes. They belonged to the Ministry of Defence until the 1980s, and the corps' highest official was a Navy rear-admiral. They have since been transferred to the Ministry of Interior and, more recently, to the newly created Ministry of Security. However, in the case of armed conflict, they can be put under the Navy's command.

Australia: Responsibilities for traditional coast guard duties in Australia are distributed across various federal, state and community volunteer agencies.

Federal: The Maritime Border Command is the de facto coast guard of Australia. The Maritime Border Command is a joint unit of the Australian Defence Force (the Royal Australian Navy Patrol Force and the Royal Australian Air Force Surveillance and Response Group) and the Australian Border Force (Marine Unit and Coastwatch aircraft). It is responsible for border protection in the exclusive economic zone of Australia and its 19,650 kilometres of coastline and issues such as illegal fishing and exploitation of natural resources, maritime terrorism and piracy, biosecurity threats, and marine pollution.
The Australian Maritime Safety Authority is responsible for maritime safety and seaworthiness of Australian and foreign vessels in Australian waters including compulsory pilotage, aids to navigation, the Australian Rescue Coordination Centre and coordination of search and rescue operations, and management of Australia's international maritime obligations.
The Australian Fisheries Management Authority is responsible for the management and sustainable use of fisheries resources and for combating illegal fishing activities in the Australian Fishing Zone.
The Australian Federal Police supports the Maritime Border Command and particularly the Australian Border Force with criminal investigations, law enforcement and national security matters.
The Office of Transport Security has various responsibilities for maritime security.

State: Each State Government also has agencies with coast guard responsibilities. For example, in Queensland, Maritime Safety Queensland is responsible for maritime safety and the Queensland Police Service has a water police unit for law enforcement along the coastline, in waterways, and for Queensland islands.

Community: In addition, there are several private volunteer coast guard organizations, the two largest organizations being the Royal Volunteer Coastal Patrol (established in 1937) and the Australian Volunteer Coast Guard (established in 1961). These volunteer organizations have no law enforcement powers, and are essentially auxiliary Search and Rescue services. In NSW these two organisations have joined to become Marine Rescue in 2009.

Bangladesh: The Bangladesh Coast Guard (Bengali transliteration: বাংলাদেশ কোস্ট গার্ড; translated from English: বাংলাদেশ উপকূল রক্ষক); BCG is the maritime law enforcement force of Bangladesh. It is a paramilitary force which is under the jurisdiction of the Ministry of Home Affairs. Its officers are transferred from the Bangladesh Navy. The Bangladesh Coast Guard also performs the duty of maritime border security of Bangladesh. The headquarters is located in Dhaka, Bangladesh. Currently the coast guard has 3,339 personnel

Barbados: 

Belize: The Belize Coast Guard (BCG) mission includes maritime safety, maritime security, marine
resources protection, maintaining sovereignty over Belize sea space, and naval defence of Belize.
Coast Guard men and women are deployed around the clock patrolling the internal waters and territorial seas. On the northern frontier, their joint operating base at Consejo protects the local economy from the negative impacts of illegal contraband and acts as the northern cut off for drug trafficking. On their southern boundary they stand guard at the Sarstoon river ensuring sovereignty and territorial integrity of Belize. They stand ready for anything (Utrinque Paratus ).
The Coast Guard Service coordinates its activities with the Belize Defence Force and the Belize Police Department.

Bosnia and Herzegovina: Having 18 kilometres of coastline only, Bosnia and Herzegovina does not have a force dedicated to defend its coast. The duty of patrolling its coastline falls to the Granična policija (English: Border Police).

Brazil: In addition to the roles of a traditional navy, the Brazilian Navy also carries out the role of organizing the merchant navy and other operational safety missions traditionally conducted by a coast guard. Other roles include: Conducting national maritime policy, and implementing and enforcing laws and regulations with respect to the sea and inland waters.

Canada: The Canadian Coast Guard (CCG) is a civilian service under the Department of Fisheries and Oceans responsible for patrolling the world's longest coastline of 243,042 km (~151,000 mi).
The CCG holds responsibility for all marine search and rescue throughout Canada.