The US attorney general, Eric Holder, has defended the Obama administration's controversial seizure of phone records from the Associated Press, saying that a story run by the news organisation had posed a major security threat to the American public.

Holder, speaking at a press conference at the Department of Justice on Tuesday, said an AP story published last year about an alleged Yemeni terrorist plot to blow up a US plane was the result of "a very, very serious leak" that justified "very aggressive action".

The White House meanwhile attempted to portray Barack Obama as a strong supporter of press freedom on Tuesday, in the face of strong condemnation of the DoJ's action. The blanket seizure amounted to one of the biggest challenges to the US media yet by the Obama administration, which has prosecuted more whistleblowers than the regime of any other recent incumbent of the White House.

Both Republican and Democratic members of Congress lined up to condemn the move against the AP, as did civil rights organisations and groups representing journalists.

At the Department of Justice, Holder said the decision to seize the phone records was connected to a criminal investigation into the leak that led to the AP's story about the Yemeni terror threat. "It put the American people at risk and that is not hyperbole," Holder said. "Trying to determine who was responsible required very aggressive action."

The AP story was embarrassing for the Obama administration as it contradicted a White House claim that there had been no plots to coincide with the first anniversary of the killing of Osama bin Laden.

Holder said he had recused himself from the investigation into the leak last year and had left it to the deputy attorney general. Holder knew the people involved and was confident they had done things properly, abiding by department rules, he said.

The phone records were taken, without informing the AP, in April and May and related to calls made from the offices of the AP in New York, Washington and Hartford, Connecticut. In a move that angered members of Congress, it also tracked calls from the AP's office in the House of Representatives press gallery. The AP described it as a "massive and unprecedented intrusion" into newsgathering operations.

Jay Carney, the White House spokesman, insisted that Obama remained a strong believer in the first amendment that protects journalists' rights, and supported reporters in their unfettered freedom to mount investigations. As a senator, Obama had supported a bill to protect journalists in pursuit of their work, Carney said.

But he added that Obama had to balance this freedom against a need to maintain secret and classified material. Carney said he could not answer any details about the seizure as it was a criminal matter and it would not be right for him to comment. Obama had only learned about it on Monday afternoon as he visited New York on a Democratic fundraising visit, Carney said. He referred questions about the details of the investigation to the Department of Justice.

The row comes as the White House was fighting fires on a number of fronts. It is being pressed by Republicans over details of how the White House and State Department handled the aftermath of last year's attack on the diplomatic mission in Benghazi that left four Americans dead. More damaging still is a fast-growing scandal over the Internal Revenue Service, whose officers targeted conservative groups seeking tax-exempt status.

It is shaping up as one of the worst weeks in office for Obama since he became president in January 2009.

Asked about criticism that Obama could now be compared to Nixon and Watergate, Carney said: "People who make this kind of comparison need to check their history."

Civil rights organisations and groups representing journalists have condemned the move against the AP.

The American Civil Liberties Union said the use of subpoenas for a broad swath of records has a chilling effect both on journalists and whistleblowers who want to reveal government wrongdoing. Laura Murphy, spokeswoman for the ACLU, said: "The attorney general must explain the Justice Department's actions to the public so that we can make sure this kind of press intimidation does not happen again."

Arnie Robbins, executive director of the American Society of News Editors, said: "It's also troubling because it is consistent with perhaps the most aggressive administration ever against reporters doing their jobs – providing information that citizens need to know about our government."

Veteran Democratic senator Patrick Leahy, chairman of the Senate judiciary committee, said in a statement: "I am very troubled by these allegations and want to hear the government's explanation."