The Coast Guard's roots lie in the Revenue Cutter Service, which was founded on August 4, 1790 as part of the Department of the Treasury. An act of the U.S. Congress created the Coast Guard in 1915, with the merger of the Revenue Cutter Service and the United States Lifesaving Service. The United States Lighthouse Service was merged into the Coast Guard in 1939. The legal basis for the Coast Guard is Title 14 of the United States Code, which states: "The Coast Guard as established January 28, 1915, shall be a military service and a branch of the armed forces of the United States at all times." Upon the declaration of war or when the President directs, the Coast Guard operates under the authority of the Department of the Navy. The Coast Guard later moved to the Department of Transportation in 1967, and on February 25, 2003 it became part of the Department of Homeland Security.
http://www.uscg.mil/top/about/