WASHINGTON (AP) -- Director of National Intelligence James Clapper has apologized for telling Congress earlier this year that the National Security Agency does not collect data on millions of Americans, a response he now says was "clearly erroneous."

Clapper apologized in a letter to Senate Intelligence Committee Chairwoman Dianne Feinstein. His agency posted the letter Tuesday on its website.

Leaks by former NSA systems analyst Edward Snowden have revealed the NSA's sweeping data collection of U.S. phone records and some Internet traffic every day, though U.S. intelligence officials have said the programs are aimed at targeting foreigners and terrorist suspects mostly overseas.

Clapper was asked during a hearing in March by Sen. Ron Wyden, an Oregon Democrat on the Intelligence Committee, if the NSA gathered "any type of data at all on millions or hundreds of millions of Americans."

At first, Clapper answered definitively: "No."

Pressed by Wyden, Clapper changed his answer. "Not wittingly," he said. "There are cases where they could inadvertently perhaps collect, but not wittingly."

Last month, in an interview with NBC News after revelations about the program, Clapper said: "I responded in what I thought was the most truthful, or least untruthful, manner" — because the program was classified.

In his letter to Feinstein, Clapper wrote that he was thinking about whether the NSA gathered the content of emails, rather than the metadata of the phone records — the record of calls to and from U.S. citizens and the length of those phone calls.

"I realized later Sen. Wyden was asking about ... metadata collection, rather than content collection," Clapper wrote. "Thus, my response was clearly erroneous, for which I apologize."

Feinstein said in a statement Tuesday: "I have received Director Clapper's letter and believe it speaks for itself. I have no further comment at this time."

Wyden spokesman Tom Caiazza said Tuesday that when Wyden staffers contacted Clapper's office shortly after the hearing, his staffers "acknowledged that the statement was inaccurate but refused to correct the public record when given the opportunity."

Story continues

"Sen. Wyden is deeply troubled by a number of misleading statements senior officials have made about domestic surveillance in the past several years. He will continue pushing for an open and honest debate," Caiazza said.

In the letter, Clapper said he could now publicly correct the record, because the existence of the metadata collection program has been declassified since the deluge of leaks from Snowden. A copy of the letter posted on the DNI website was stamped June 21 but made public on Tuesday.

Snowden is believed to be in a Moscow airport transit area, seeking asylum from one of more than a dozen countries.

Since the revelations, the Obama administration has said the leaks have caused damage to national security, including tipping off al-Qaida and other terrorist groups to specific types of U.S. electronic surveillance.

But under pressure from lawmakers and privacy activists, the administration took the extraordinary step of declassifying many of the details surrounding the surveillance programs and how they work, to explain to Americans that NSA is not spying directly on them, which would violate its charter.