What to do if detained at port of entry?

All travelers to the U.S. are subject to inspection by U.S. Customs and Border Protection (CBP).  CBP may search your belongings, including your electronic devices, to determine if you have violated any immigration or criminal laws.
What to do when encountering Immigration & Customs Enforcement (ICE) 
The legal authority of ICE to arrest and detain noncitizens under U.S. civil immigration laws is not unlimited.  Notably, the U.S. Constitution applies to everyone physically present in the U.S. It is important for you to understand your legal rights so you can assert them when necessary.