Media playback is unsupported on your device Media caption David Miranda told the BBC he felt very threatened during his detention

A Brazilian man held for nine hours at Heathrow airport under anti-terror laws says he feels "invaded" after divulging his email and social media passwords.

David Miranda said his interrogators threatened he could go to prison if he did not co-operate.

Mr Miranda is the partner of Guardian journalist Glenn Greenwald who has covered stories based on leaks by US whistle-blower Edward Snowden.

Mr Miranda is challenging the legality of his detention.

He wants his confiscated electronic equipment returned and assurances that his private data will not be distributed on to other parties.

Mr Miranda told the BBC he was forced to disclose his social media passwords.

"I am very angry. This feeling of invasion. It's like I'm naked in front of a crowd," he said. "They said I had to co-operate or else I was going to jail."

'Entire life'

It never occurred to me that anything I would be carrying was material for terrorists David Miranda

A Downing Street spokesman has said Number 10 was "kept abreast" of the decision to detain Mr Miranda, 28, who was held on Sunday on his way from Berlin to Rio de Janeiro, where he lives with Mr Greenwald.

The Guardian said he had been carrying "journalistic materials" but was not an employee of the newspaper.

Mr Greenwald has broken stories about state surveillance with information from fugitive Mr Snowden who used to work as a contractor at the US National Security Agency.

In Germany, Mr Miranda had been staying with US film-maker Laura Poitras, who has also reportedly been working on the Snowden files with the Guardian.

He told the BBC he did not know what he was carrying.

"Laura and Glenn are both journalists and I trust them. It never occurred to me that anything I would be carrying was material for terrorists," he said.

Mr Miranda said he was held in a room and questioned by six agents about his "entire life".

Image caption David Miranda (left) was met by Glenn Greenwald when he arrived back in Brazil

His lawyers said they had confiscated his laptop, an additional hard drive, two memory sticks, a mobile phone, a smart watch and a video games console.

Mr Miranda was detained under schedule 7 of the Terrorism Act 2000.

This allows police to hold someone at an airport, port or international railway station for up to nine hours for questioning about whether they have been involved with acts of terrorism.

Under schedule 7, if someone fails to co-operate they are deemed to have committed a criminal offence and could face up to three months in prison, a fine or both.

Scotland Yard maintained the detention was "legally and procedurally sound".

Home Secretary Theresa May said the police had to act if someone had "highly sensitive, stolen information".

Mr Miranda's detention has sparked a row about the use of the terror powers.

Shadow home secretary Yvette Cooper said the government had questions to answer, adding: "We still don't know on whose legal advice this crucial decision was taken to use terrorism powers."

Former Lord Chancellor Lord Falconer, who helped introduce the Terrorism Act 2000 when Labour was in office, said the wrong law was used to detain Mr Miranda.

"The problem the state is dealing with here is that they worry that some material, if published, might damage national security," he told the BBC.

"Well, use the powers they've got to deal with that, don't use these powers, which are intended to be used only against people who are or might be terrorists."

Media playback is unsupported on your device Media caption Former Lord Chancellor, Lord Falconer: "It does look like the wrong powers were used"

Intelligence experts

Mr Miranda's law firm Bindmans has written to the home secretary and the Metropolitan Police challenging the legality of the decision to detain him using schedule 7.

They have also demanded assurances that none of the material seized will be disclosed or shared.

Government officials and lawyers are meeting to discuss the request.

BBC home affairs correspondent Danny Savage said that, according to legal papers, the confiscated gadgets contained "sensitive, confidential journalistic material".

Meanwhile, it has emerged Prime Minister David Cameron ordered Britain's top civil servant, Cabinet Secretary Sir Jeremy Heywood, to contact the Guardian about material it had obtained from Mr Snowden.

The discussions resulted in the newspaper destroying a number of computer hard drives in July, under the supervision of intelligence experts from GCHQ.

It is understood the files had already been copied, and the Guardian is expected to continue pursuing the Snowden story from the US. Mr Snowden is currently in Russia after the state granted him temporary asylum.