Media playback is unsupported on your device Media caption David Miranda: "I was kept in a room with six agents... asking me about everything. My whole life"

The US government has said British officials gave it a "heads up" about the detention of the partner of a journalist who published information from US whistleblower Edward Snowden.

But it said the decision to detain David Miranda was a British one taken "independent of our direction".

Mr Miranda, 28, was held for nine hours by police at Heathrow on Sunday.

The Met Police said the use of the Terrorism Act to detain Mr Miranda was "legally and procedurally sound".

He was detained under schedule 7 of the Terrorism Act 2000. This allows police to hold someone at an airport, port or international rail station for up to nine hours for questioning about whether they have been involved with acts of terrorism.

Mr Miranda said he was kept in a room and questioned about his "whole life".

Senior British politicians and the independent reviewer of terrorism legislation, David Anderson QC, have called on police to explain why Mr Miranda was detained.

Scotland Yard, which has not said on what grounds he was detained, said in a statement on Monday night that the "examination" of Mr Miranda was "subject to a detailed decision-making process".

"The procedure was reviewed throughout to ensure the examination was both necessary and proportionate.

"Our assessment is that the use of the power in this case was legally and procedurally sound.

"Contrary to some reports, the man was offered legal representation while under examination and a solicitor attended.

"No complaint has been received by the MPS at this time."

'Best interests'

Brazil's foreign minister Antonio Patriota has called the detention of Mr Miranda - a Brazilian national - "not justifiable" and sought answers from his UK counterpart William Hague.

The Foreign Office said Mr Hague had spoken to Mr Patriota and the pair had "agreed that Brazil and UK officials will remain in contact on this issue".

During a press conference at the White House, deputy spokesman Josh Earnest was asked about whether the US had played a part in the decision to detain Mr Miranda.

Analysis The stopping of David Miranda was highly unusual and will be just as controversial. These powers are often used to have a look at an individual heading in or out of the country to see if there is any evidence linking them to terrorism. That may involve questioning and a search of their belongings. In this case the search will likely be the key aspect. Police may well have been looking for any classified information originating from British and American intelligence and obtained by Edward Snowden. But this was not a random stop by a policeman on the ground. So who wanted him searched? Was it British intelligence? Or could it have been a request from the US? That's something it has denied although it won't stop questions. Another controversy will be over the stretching of counter-terrorism powers for something which doesn't look like it has anything to do with terrorism. Powers are often justified on the basis of stopping terrorist attacks. But what will the reaction be when they are used for something else? Add to this the fact the Brazilian government is clearly unhappy and that Glenn Greenwald says he will now go after British intelligence more aggressively in his journalism and you have to wonder if the person who made the decision might just be wondering if it was worth it.

He said: "This was a law enforcement action take by the British government and this was something that they did independent of our direction.

"As you would expect, the British government is going to make law enforcement decisions that they determine are in the best interests of their country.

"There was a heads up that was provided by the British government, so this was something we had an indication was likely to occur.

"But it is not something that we requested and it was something that was done specifically by the British law enforcement officials there."

BBC correspondent Kim Ghattas, in Washington, said it was likely that the "heads up" about Mr Miranda's detention was passed to US officials when his name was spotted on passenger lists.

The White House declined to comment on whether Mr Miranda's name was on a "watch list" maintained by the US Transportation Security Administration.

It also declined to comment on whether the US was given access to Mr Miranda's laptop or anything on the laptop.

Mr Miranda was held at Heathrow on Sunday on his way from Berlin to Rio de Janeiro, where he lives with his partner, Guardian journalist Glenn Greenwald.

"I remained in a room, there were six different agents coming and going, talking to me," Mr Miranda said.

"They asked questions about my whole life, about everything.

"They took my computer, video game, mobile phone, my memory cards, everything."

'Bullying'

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

His flights were being paid for by the Guardian. A spokesman said he was not an employee of the newspaper but "often assists" with Mr Greenwald's work.

Media playback is unsupported on your device Media caption Keith Vaz concerned about use of anti-terror laws

Under schedule 7, anyone detained must "give the examining officer any information in his possession which the officer requests". Any property seized must be returned after seven days.

Mr Anderson said it was very unusual for someone to be held for the full nine hours, and he wanted to "get to the bottom" of what had happened.

He said he had asked the Home Office and Scotland Yard for a full briefing.

The Guardian said it was "dismayed" by the detention and was "urgently seeking clarification from the British authorities" as to why it had happened.

Mr Greenwald said the British authorities' actions in holding Mr Miranda amounted to "bullying" and linked it to his writing about Mr Snowden's revelations concerning the US National Security Agency (NSA).

Media playback is unsupported on your device Media caption Julian Assange tells Radio 4's PM programme that the detention was "an attack on journalism"

Mr Snowden, who has been granted temporary asylum in Russia, leaked details of extensive internet and phone surveillance by American intelligence services.

According to the Guardian, he passed "thousands of files" to Mr Greenwald, who has written a series of stories about surveillance by US and UK authorities.

Mr Greenwald said his partner's detention was "clearly intended to send a message of intimidation to those of us who have been reporting on the NSA and [UK intelligence agency] GCHQ".

The Home Office said: "Schedule 7 forms an essential part of the UK's security arrangements - it is for the police to decide when it is necessary and proportionate to use these powers."