The detention of David Miranda, the partner of the former Guardian journalist Glenn Greenwald, at Heathrow airport was unlawful and the first time journalistic material has been seized under a controversial provision of the Terrorism Act, his lawyers have told the high court.

Their claim alleges that counter-terrorism powers under schedule 7 to the act should not have been used, insists Miranda was not involved in terrorism and says that his right to freedom of expression was curtailed.

The Brazilian national, who was detained as he passed through Heathrow on 18 August this year, was in transit between Berlin and Rio de Janeiro. In Germany, he had met the film-maker Laura Poitras, who has been involved in breaking revelations based on documents leaked by Edward Snowden.

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

Miranda's legal action is against the home secretary and the commissioner of the Metropolitan police. Lawyers for the minister and the police say he was stopped because of concerns about national security and terrorism. Lawyers for the Home Office said lives could have been be endangered.

Miranda's lawyers say that the police misused schedule 7 and that his detention was a violation of his human rights.

At the start of the hearing on Wednesday, lawyers for the Home Office said they accepted that items examined by officers included journalistic material. Stephen Kovats QC, for the Home Office, told the court: "We now do not deny that amongst material that Mr Miranda was carrying is journalistic material … material that has been worked upon by a journalist with a view to publication."

But he qualified the admission by adding: "We do not understand that raw 'Snowden data' is journalistic material." Kovats said the government had no records about previous seizures of journalistic material under schedule 7.

Ten media and free speech organisations, including Liberty, Index on Censorship and the International Federation of Journalists, have intervened to express concerns to the court about the use of anti-terror powers against journalists.

Documents submitted to the court show that police briefly speculated there might have been some kind of Russian plot based on the fact that Snowden has been given asylum in Moscow.

Matthew Ryder QC, for Miranda, told the court that the detention was the first time journalistic material had been seized under schedule 7.

The officers who detained Miranda, Ryder said, were "completely in the dark" about the purpose of stopping Miranda "and that is what makes it an impotent exercise". Ryder said that if the authorities wanted to obtain the documents, an application should have been made in advance to a judge. The court heard arguments about what constitutes journalistic material under recent court precedents and whether all documents handed over would have specific protection.

The case is being considered by a panel of three judges: Lord Justice Laws, Mr Justice Ouseley and Mr Justice Openshaw. Laws said he did not believe that what was in individual officers' minds at any one time was as significant as the overall purpose of the police operation. He said: "The security service had a clear desire to get that material to stop its use by the newspapers. The government wanted that material back.

"The dominant purpose here [was] to ascertain whether Mr Miranda was in possession of what the security service feared and, if he was, to get hold of it and neutralise [it]."

In a written submission to the court, lawyers for the Home Office defended the use of schedule 7, which is supposed to be used for terrorism. It said: "It is surely also capable of covering the publication, or threatened publication, of stolen classified information which, if published, would reveal personal details of members of the armed forces or security and intelligence services thereby endangering their lives where that publication or threatened publication is designed to influence government policy on the activities of the security and intelligence agencies. Lives are endangered. The design is to influence a government."

In a witness statement filed at the high court, Miranda said: "I believe the schedule 7 powers were wrongly used against me and I hope this court will make that clear. If the authorities are allowed to use counter-terrorist powers in this way the chilling effect on freedom of expression both in the UK and around the world is substantial."

Miranda's partner, Glenn Greenwald, said in a separate court statement: "Responsible publication of sensitive material is not an act of terrorism. And those involved in such work – the journalists and those who assist them – are not involved in terrorist activity".

In a separate judgment, the high court ruled that police and immigration officers who questioned a man at Heathrow airport under schedule 7 on his return from the hajj in Saudi Arabia acted unlawfully when they refused to wait 45 minutes for the arrival of his solicitor.

The judge awarded the man, Abdelrazag Elosta, nominal damages for the incident. The judge said Elosta was "entitled to a declaration that the refusal of the officers to await the arrival of his solicitor after he was detained on 10 November 2012 and therefore before putting further questions to him was in the circumstances of the case unlawful".

The case continues on Thursday.