U.S. Customs and Border Protection (CBP) is a federal law enforcement agency, and a subdivision of the United States Department of Homeland Security. CBP is the largest law enforcement agency in the United States with over 60,000 employees, 45,000 of which are sworn officers. For comparison, the next largest law enforcement agency in the US is the FBI with 35,104 employees.
CBP is primarily responsible for preventing terrorists from entering the country, but also handles entering undocumented immigrants of all kinds, preventing the importation of illegal drugs and other contraband, and protecting agricultural and environmental interests by the prevention of the introduction of foreign pests, plants, or diseases. CBP also plays a role in protecting American intellectual property interests. The CBP is tasked with regulating and facilitating international trade, they collect import duties, and enforce U.S. trade, customs, and immigration regulations.
The most visible role of CBP is is the guarding the approximate 7,000 miles of land border shared with Canada and Mexico and the 2,000 miles of coastal waters surrounding the Florida peninsula and off the coast of Southern California. The agency also protects 95,000 miles of maritime border in a joint role with the Coast Guard. More than 21,180 CBP officers inspect and examine passengers and cargo at 328 ports of entry.
Homeland security became a primary concern of the US nation after the terrorist attacks of September 11, 2001. CBP was created in 2003 when the former Immigration and Naturalization Service (INS) was dismantled into three agencies - USCIS, ICE, and CBP, all under the newly created US Department, the Department of Homeland Security. They then expanded in size.
Both CBP and ICE are law enforcement for immigration. But CBP cannot look for immigrants that already in the U.S.. and ICE has no authority to keep people out.