From the Document: "The Immigration and Nationality Act (INA) authorizes-- and in some cases requires--the Department of Homeland Security (DHS) to detain non-U.S. nationals (aliens) who are subject to removal from the United States. This detention scheme is multifaceted, with rules that turn on several factors, such as whether the alien is seeking admission or has been lawfully admitted into the country; whether the alien has engaged in certain proscribed conduct; and whether the alien has been issued a final order of removal. This In Focus provides a brief introduction to the immigration detention framework."
CRS In Focus, IF11343
Congressional Research Service: https://crsreports.congress.gov/