The Department of Homeland Security's primary function is the prevention of terrorist attacks occurring within America and, in the extreme case of an attack happening, holding losses to the smallest possible level and swiftly carrying out restoration.