In March, Judge Denise J. Casper of Federal District Court in Massachusetts denied the government’s motion to dismiss the suit, saying that although the government did not need reasonable suspicion to search someone’s laptop at the border, that power did not strip Mr. House of his First Amendment rights. Legal scholars say this ruling could set the stage for the courts to place some limits on how the government conducts digital searches.

“The District Court basically said you don’t need individualized suspicion to search an electronic device at the border,” said Patrick E. Corbett, a professor of criminal law and procedure at Thomas M. Cooley Law School in Lansing, Mich. “What they were troubled with was the fact that the government held these devices for 49 days.”

Customs and Border Protection, part of the Department of Homeland Security, declined to discuss the policy in an interview, but a spokeswoman for the agency said in an e-mail: “Keeping Americans safe and enforcing our nation’s laws in an increasingly digital world depends on our ability to lawfully screen all materials — electronic or otherwise — entering the United States. We are committed to ensuring the rights and privacies of all people while making certain that D.H.S. can take the lawful actions necessary to secure our borders.”

The statement also referred to the agency’s policy on border searches of electronic devices, which says that officers can keep these devices for a “reasonable period of time,” including at an off-site location, and seek help from other government agencies to decrypt, translate or interpret the information they contain. If travelers choose not to share a password for a device, the government may hold it to find a way to gain access to the data.

The agency did provide recent statistics on how many travelers this policy affects. From Oct. 1, 2011, through Aug. 31, 2012, 11.9 million travelers were referred to secondary screening after entering the United States. Of those searches, 4,898 included an electronic device. In the previous year, 12.1 million people underwent additional screening, with 4,782 searches of electronic devices.

While there is little public information about who is pulled aside for extra scrutiny, some people whose laptops have been searched say they feel they were selected based on their academic, journalistic or political pursuits.

Laura Poitras, a documentary filmmaker and the recipient of a 2012 MacArthur Fellowship, estimates that she has been detained more than 40 times upon returning to the United States. She has been questioned for hours about her meetings abroad, her credit cards and notes have been copied, and after one trip her laptop, camera and cellphone were seized for 41 days.