Image copyright Getty Images Image caption David Miranda (left) had his laptop seized by UK authorities - presumably because he is the partner of journalist Glenn Greenwald

A federal judge in New York has ruled authorities can seize travellers' laptops at the border without citing a legal reason, suspecting the traveller of a crime, or explaining themselves in any way. What happens if they take yours?

The news over the past year has been filled with stories of the National Security Agency (NSA) and its surveillance operations and the risks to online privacy.

The release of documents obtained by former NSA contractor Edward Snowden sheds new light on its global electronic spying programme.

Yet authorities can also find out about you in a more traditional manner - by seizing your possessions at the border.

Long ago the authorities could read your diary. Now they can go through your laptop's hard drive. The federal judge was upholding a policy about border seizures formalised after the 2001 al-Qaeda attacks.

What will they do to my laptop? Copy items from the hard drive - or duplicate it entirely

Study the contents while ignoring anything deemed not germane to the investigation - according to the policy

Return the laptop to you, sometimes weeks later

If the US authorities choose, they can seize your computer at the border and search it for evidence of criminal activity, foreign intelligence links, or terrorist ties.

Political activists, academics and journalists say they are worried about having their laptops seized when they cross the border. Many of them have responded to the threat by attending workshops run by privacy experts to learn about protecting their data while travelling.

"Searches of electronic media, permitted by law and carried out at borders and ports of entry, are vital to detecting information that pose serious harm," says a US Department of Homeland Security official.

Paul Rosenzweig, a visiting fellow at the Heritage Foundation, a think-tank in Washington, says this should not be surprising.

"We haven't had any privacy crossing into the US since the country was founded," he says.

"If the CBP agent is having a bad day," he says, using an acronym for the US Customs and Border Protection, "they can empty your suitcase on the ground. It's kind of the foundation of how we protect the borders of America."

Suitcases, laptops, thumb drives, PDAs - all are subject to inspection.

Image copyright Getty Images Image caption David House's laptop was seized while he was returning from Mexico

If the authorities take your laptop, expect they will copy everything on its hard drive. Afterwards they may send the copy to the US Army's criminal-investigative division in Fort Belvoir, Virginia.

That is what they did after they seized the computer of David House, an activist who had been raising money for the legal defence of Chelsea Manning (formerly Bradley Manning).

House's belongings were seized when he returned from holiday in Mexico in November 2010.

Afterwards the authorities transferred images and files from his laptop to a "forensic machine", according to a US Army Criminal Investigation Command report published by the American Civil Liberties Union in the autumn.

During their inspection of your laptop, the authorities will disregard files that are not germane to their investigation, says Rosenzweig, explaining that the official policy is to "flush all non-criminal data".

"If they find your pizza recipe or notes to your lover, they'll ignore that," says Rosenzweig. "You either believe that or you don't, depending on your belief in the government."

Afterwards you get your laptop back - though not right away. "It can take days or weeks for the laptop to be returned," says Georgia Institute of Technology's Peter Swire.

Other nations have similar practices. British authorities seized the computer of a Brazilian citizen, David Miranda, at Heathrow Airport under anti-terrorism laws in August 2013.

He is the partner of journalist Glenn Greenwald, who has published a series of revelations about the US surveillance programmes based on the Snowden documents. Miranda was held for nine hours.

Still, it is rare authorities take an interest in a traveller's laptop.

Between October 2008-August 2009, for example, more than 220 million people travelled to and from the US, according to Department of Homeland Security officials.

During that time authorities searched about 1,000 laptops carried by travellers.

The prospect may be unlikely, but it is alarming. Those who want to keep their data safe can encrypt their hard drives.

"I encrypt all my confidential information with a very strong programme that is probably beyond the capacity of the FBI to break," says Rosenzweig. "I believe I cannot be compelled to give away the password, which I have never written down."

Or you can scrub your laptop clean, storing everything on an external hard drive that you leave at home. Then you know you are safe from prying authorities, at least at the border.