Amnesty International has condemned the detention of Guardian journalist Glenn Greenwald's partner at a London airport as "unwarranted revenge tactics" based solely on his relationship with Greenwald.

David Miranda was detained when in transit at Heathrow under schedule seven of Britain's Terrorism Act 2000, and held for almost nine hours – the maximum time allowable before further authority is required.

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

"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."

Miranda's partner Greenwald, the Guardian journalist who reported Edward Snowden's revelations about National Security Agency surveillance, said he had received a call from a security official at the airport three hours into the questioning to inform him of Miranda's detention.

"The official – who refused to give his name but would only identify himself by his number: 203654 – said David was not allowed to have a lawyer present, nor would they allow me to talk to him," Greenwald wrote.

He added: "But they obviously had zero suspicion that David was associated with a terrorist organisation or involved in any terrorist plot. Instead, they spent their time interrogating him about the NSA reporting which Laura Poitras, the Guardian and I are doing, as well the content of the electronic products he was carrying."

Miranda was on his way back to Brazil, where he lives with Greenwald, after visiting the US film-maker Laura Poitras in Berlin, who has also been involved in the NSA stories. The Guardian paid for Miranda's flights.

Schedule seven allows police to detain people at British border points with or without probable cause. No lawyer is provided automatically and it is a criminal offence for the detainee to refuse to answer questions, whether or not a lawyer is present. The role of the act is to support counter-terrorism efforts, which Amnesty International said has no relevance to Miranda's detention.

"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 ... Greenwald, for his role in analysing the data released by Edward Snowden," Brown said.

"States cannot pass anti-terror acts and claim they are necessary to protect people from harm and then use them to retaliate against someone exercising his rights. By targeting Miranda and Greenwald, the government is also sending a message to other journalists that if they maintain their independence and report critically about governments, they too may be targeted."