U.S. border agents should continue to be allowed to search a traveler’s laptop, cellphone or other electronic device and keep copies of any data on them based on no more than a hunch, according to an internal Homeland Security Department study. It contends limiting such searches would prevent the U.S. from detecting child pornographers or terrorists and expose the government to lawsuits.

The 23-page report, obtained by The Associated Press and the American Civil Liberties Union under the U.S. Freedom of Information Act, provides a rare glimpse of the Obama administration’s thinking on the long-standing but controversial practice of border agents and immigration officers searching and in some cases holding for weeks or months the digital devices of anyone trying to enter the U.S.

Since his election, President Barack Obama has taken an expansive view of legal authorities in the name of national security, asserting that he can order the deaths of U.S. citizens abroad who are suspected of terrorism without involvement by courts, investigate reporters as criminals and — in this case — read and copy the contents of computers carried by U.S. travelers without a good reason to suspect wrongdoing.