Border controls exist to check on travellers where there is insufficient information to justify an arrest, lawyers for the Home Office told the high court on Thursday.

Justification for controversial port stops under schedule 7 of the Terrorism Act 2000 – under which around 60,000 passengers a year are questioned – emerged during David Miranda's legal challenge of his detention at Heathrow airport.

On the second day of the hearing at the Royal Courts of Justice, lawyers for the Metropolitan police and Home Office defended their decision to detain Miranda, who is the partner of the former Guardian journalist Glenn Greenwald.

Lawyers for the Met said they had "legitimate" concerns about how the encrypted material Miranda was carrying had been "arranged" as they feared all of the Edward Snowden material could be released, endangering lives.

The Brazilian national claims it was unlawful to stop him under schedule 7 on 18 August this year, denies that he was involved in terrorism and argues that his right to freedom of expression was curtailed.

He was in transit between Berlin, where he had met the film-maker Laura Poitras who has been involved breaking revelations based on documents leaked by Snowden, and Rio de Janeiro.

Stories published in the Guardian and other newspapers have exposed the extent of mass surveillance online carried out by the US National Security Agency (NSA) and the UK's monitoring operation GCHQ.

Stephen Kovats QC, for the Home Office, told the court that border controls were "to allow people coming in [to the UK] to be stopped and checked … It's to cover those important contingencies where there's not enough information to justify arrests that you have border controls."

There was a risk of sensitive material being taken from well-intentioned people, Kovats explained. "You are putting lives in danger [carrying the material] if there's a risk that a member of al-Qaida will relieve Mr Miranda of his hard drive and then use it for … malevolent purposes. We would say that for the purposes of schedule 7 that [makes Miranda] a person of concern."

Jason Beer QC, for the Metropolitan police, said officers wanted to know how the encrypted material was arranged: whether it was split into material that was be disclosed and material that would not be published. "[They] may have [been considering] to do as Mr Assange has done and upload all the material on to a blog," he suggested. "It was a legitimate concern to see whether the material was arranged in that way."

The main risk that concerned officers, Beer said, "was not in the context of the journalism to date and or … through responsible journalism in future". It was fear "of release of all the [Snowden] material and the consequent harm that would be caused – the danger was of endangering lives".

Beer added: "The police had received a request from the security services to make the stop seem as routine as possible." Between 60,000 and 100,000 people a year are examined in port stops every year. "The definition of section one [of the Terrorism Act] is exceptionally broad … Terrorism is terrorism, whatever the motives"

At that point Mr Justice Ouseley, one of three judges considering the case, intervened to comment: "Just as well it was not in force during world war two, it might have applied to the French Resistance."

Mathew Ryder QC, for Miranda, said the police were inventing "doomsday scenarios" and failing to consider whether use of schedule 7 powers was proportionate. "Otherwise it gets to the point where the government's judgment is not being scrutinsed," he said. "Journalists, like judges, have a role within this democracy of at times scrutinising government action."

Judgment will be delivered at a later date.