In recent months, Barack Obama has forcefully defended the use of the Patriot Act to gather the phone records of every American. But before he was elected president, he had a very different perspective on the issue.

In December 2005, Congress was debating the first re-authorization of the Patriot Act, a controversial 2001 law that gave the federal government expanded power to spy on Americans. And Barack Obama was one of nine senators who signed a letter criticizing the then-current version of the legislation for providing insufficient protections for civil liberties.

The senators focused on Section 215 of the Patriot Act, which allows the government to obtain "business records" that are "relevant" to a terrorism investigation. Sen. Obama and eight of his colleagues worried that the provision would "allow government fishing expeditions targeting innocent Americans. We believe the government should be required to convince a judge that the records they are seeking have some connection to a suspected terrorist or spy."

Congress eventually re-authorized the Patriot Act, including Section 215. A few years later, Obama was elected president of the United States. And under President Obama's watch, the NSA engaged in surveillance suspiciously similar to the broad "fishing expeditions" Sen. Obama warned about.

The government has argued that records of every phone call made in the United States are "relevant" to counter-terrorism investigations generally, allowing them to obtain information about the private phone calls of millions of Americans — exactly the kind of argument Sen. Obama warned the government would make if the language of Section 215 wasn't tightened.

Sen. Obama and his colleagues also objected to the lack of transparency and due process in Section 215. "The target of a Section 215 order never receives notice that the government has obtained his sensitive personal information and never has an opportunity to challenge the use of this information in a trial or other proceeding," they wrote.

Again, this prediction proved prescient. In 2012, Sen. Ron Wyden (D-Ore.) asked the NSA for a "ballpark estimate" of the number of Americans who had been subject to NSA surveillance. The NSA refused, claiming that revealing the number would violate the targets' privacy. We now know that the figure was in the hundreds of millions. And prior to NSA leaker Edward Snowden's disclosures, none of them received notice of the surveillance or an opportunity to challenge it in court.

So what changed Obama's mind? Obviously, being elected president makes people more comfortable with presidential power and less enthusiastic about limits on that power. It's also possible that when Obama became president and began receiving intelligence briefings, he became more alarmed about terrorist threats and more willing to limit civil liberties to deal with them. In any event, it seems likely that if Obama were still in the Senate, he'd be joining Wyden in criticizing the NSA's use of the Patriot Act to spy on millions of Americans.

Correction: This story originally stated, incorrectly, that Ron Wyden signed the 2005 letter. We regret the error.