President Obama on Thursday strongly defended the Justice Department leaks investigation that secretly gathered private phone records of Associated Press journalists, suggesting that protecting U.S. personnel overseas outweighs press privileges in this case.

"Leaks related to national security can put people at risk. They can put men and women in uniform that I've sent into the battlefield at risk," Obama said during a news conference with visiting Turkish Prime Minister Recep Tayyip Erdogan. "And so I make no apologies, and I don't think the American people would expect me, as commander in chief, not to be concerned about information that might compromise their missions or might get them killed."

Earlier this week, AP president and chief executive Gary B. Pruitt disclosed that federal authorities had secretly obtained cellular, office and home telephone records of journalists working in Washington, New York, and Hartford, Conn. The records included the main number for AP reporters covering Congress.

Pruitt called the government action - part of a Justice Department investigation into leaks surrounding a 2012 AP story that included details of a CIA operation in Yemen that prevented a bomb attack on a commercial airplane in the United States - a "massive and unprecedented intrusion" into news-gathering activities.

Obama campaigned on a pledge to increase government transparency and to restore the rule of law to national security policy. Civil liberties advocates denounced the Justice Department actions, as did members of Congress from both parties.

On Thursday, Obama, a former constitutional law lecturer, acknowledged press interests as part of his argument that a balance must be struck between First Amendment guarantees and national security considerations.

"We also live in a democracy where a free press, free expression and the open flow of information helps hold me accountable, helps hold our government accountable and helps our democracy function," he said. "And, you know, the whole reason I got involved in politics is because I believe so deeply in that democracy and that process."

Asked if he still supported Attorney General Eric H. Holder Jr., Obama said, "I have complete confidence in Eric Holder as attorney general."

"He's an outstanding attorney general and does his job with integrity, and I expect he will continue to do so," Obama said.