The partner of the Guardian journalist who has written a series of stories revealing mass surveillance programmes by the US National Security Agency was held for almost nine hours on Sunday by UK authorities as he passed through London's Heathrow airport on his way home to Rio de Janeiro.

David Miranda, who lives with Glenn Greenwald, was returning from a trip to Berlin when he was stopped by officers at 8.05am and informed that he was to be questioned under schedule 7 of the Terrorism Act 2000. The controversial law, which applies only at airports, ports and border areas, allows officers to stop, search, question and detain individuals.

The 28-year-old was held for nine hours, the maximum the law allows before officers must release or formally arrest the individual. According to official figures, most examinations under schedule 7 – over 97% – last less than an hour, and only one in 2,000 people detained are kept for more than six hours.

Miranda was released, but officials confiscated electronics equipment including his mobile phone, laptop, camera, memory sticks, DVDs and games consoles.

Since 5 June, Greenwald has written a series of stories revealing the NSA's electronic surveillance programmes, detailed in thousands of files passed to him by whistleblower Edward Snowden. The Guardian has also published a number of stories about blanket electronic surveillance by Britain's GCHQ, also based on documents from Snowden.

While in Berlin, Miranda had visited Laura Poitras, the US film-maker who has also been working on the Snowden files with Greenwald and the Guardian. The Guardian paid for Miranda's flights.

"This is a profound attack on press freedoms and the news gathering process," Greenwald said. "To detain my partner for a full nine hours while denying him a lawyer, and then seize large amounts of his possessions, is clearly intended to send a message of intimidation to those of us who have been reporting on the NSA and GCHQ. The actions of the UK pose a serious threat to journalists everywhere.

"But the last thing it will do is intimidate or deter us in any way from doing our job as journalists. Quite the contrary: it will only embolden us more to continue to report aggressively."

A spokesperson for the Guardian said: "We were dismayed that the partner of a Guardian journalist who has been writing about the security services was detained for nearly nine hours while passing through Heathrow airport. We are urgently seeking clarification from the British authorities."

A spokesperson for Scotland Yard said: "At 08:05 on Sunday, 18 August a 28-year-old man was detained at Heathrow airport under schedule 7 of the Terrorism Act 2000. He was not arrested. He was subsequently released at 17:00."

Scotland Yard refused to be drawn on why Miranda was stopped using powers that enable police officers to stop and question travellers at UK ports and airports.

There was no comment from the Home Office in relation to the detention. However, there was surprise in political circles and elsewhere. Labour MP Tom Watson said he was shocked at the news and called for it to be made clear if any ministers were involved in authorising the detention.

He said: "It's almost impossible, even without full knowledge of the case, to conclude that Glenn Greenwald's partner was a terrorist suspect.

"I think that we need to know if any ministers knew about this decision, and exactly who authorised it."

"The clause in this act is not meant to be used as a catch-all that can be used in this way."

Schedule 7 of the Terrorism Act has been widely criticised for giving police broad powers under the guise of anti-terror legislation to stop and search individuals without prior authorisation or reasonable suspicion – setting it apart from other police powers.

Those stopped have no automatic right to legal advice and it is a criminal offence to refuse to co-operate with questioning under schedule 7, which critics say is a curtailment of the right to silence.

Last month the UK government said it would reduce the maximum period of detention to six hours and promised a review of the operation on schedule 7 amid concerns it unfairly targets minority groups and gives individuals fewer legal protections than they would have if detained at a police station.

The government of Brazil issued a statement in which it expressed its "grave concern" over the detention of one of its citizens and the use of anti-terror legislation. It said: "This measure is without justification since it involves an individual against whom there are no charges that can legitimate the use of that legislation. The Brazilian government expects that incidents such as the one that happened to the Brazilian citizen today are not repeated."

Widney Brown, Amnesty International's senior director of international law and policy, said: "It is utterly improbable that David Michael Miranda, a Brazilian national transiting through London, was detained at random, given the role his partner has played in revealing the truth about the unlawful nature of NSA surveillance.

"David's detention was unlawful and inexcusable. He was detained under a law that violates any principle of fairness and his detention shows how the law can be abused for petty, vindictive reasons.

"There is simply no basis for believing that David Michael Miranda presents any threat whatsoever to the UK government. The only possible intent behind this detention was to harass him and his partner, Guardian journalist Glenn Greenwald, for his role in analysing the data released by Edward Snowden."