David Miranda's lawyer said he was taking legal action because the Home Office and police had refused to provide assurances they would not share files seized on Miranda's laptop.
Matthew Ryder QC told judges the Home Secretary and the commissioner of the Metropolitan Police had failed to give undertakings "protecting the confidentiality of sensitive journalistic material".
"That is why we are here now," Ryder said at London's High Court.
Miranda, the partner of Guardian journalist Glenn Greenwald, has launched an application for judicial review over his detention at Heathrow airport under the Terrorism Act.
The independent reviewer of terrorism legislation said he will examine the detention of David Miranda at Heathrow Airport.
Nick Clegg has backed David Cameron's decision to send a top civil servant to The Guardian to urge them to destroy classified data.
The Guardian journalist whose partner was held at Heathrow Airport hits out at the UK as he gives ITV News his first British TV interview.