Nearly two years after the US government's collection of telephone calls became public following the Edward Snowden leaks, the US House of Representatives has passed, by a vote of 338-88, the USA Freedom Act, a bill that would end the government's phone surveillance database. The data will still be available for government searches, but it will lie with the individual phone companies.

The bill was opposed by 47 Republicans and 41 Democrats, most of whom said the proposal didn't go far enough to protect civil liberties. A roll call of votes on the bill is available here.

Policymakers on all sides of the surveillance debate were under pressure to make some kind of move, with relevant portions of the Patriot Act set to expire at the end of this month. The USA Freedom Act ends the bulk phone database but doesn't include many other wished-for reforms, such as a privacy advocate at the Foreign Intelligence Surveillance Court, which was in an earlier version of the bill. It also doesn't include "minimization" procedures meant to make sure the government purges information about people not related to its investigations.

The bill now heads to the Senate, where some Republican lawmakers, including Sen. Majority Leader Mitch McConnell (R-Ky.), have said that the bulk database shouldn't be ended at all. That set off threats of a filibuster by surveillance reformers like Sens. Ron Wyden (D-Ore.) and Rand Paul (R-Ky.) It's unclear how the bill will fare in the upper house.

The USA Freedom Act is supported by the Obama Administration, which says it "strikes an appropriate balance between significant reform and preservation of important national security tools."

Earlier today, Speaker of the House Rep. John Boehner (R-Ohio) told The Washington Post he expected the bill to pass, saying it preserves key programs while establishing limits. "These programs expire at the end of this month," he said. "They are critically important to keep Americans safe. The House is going to act, and I would hope the Senate would act soon as well.”

The bill has been weakened enough that it's split some groups advocating reform.

The Electronic Frontier Foundation pulled its support for the bill earlier this week, stating that in the wake of a 2nd Circuit ruling that the collection was illegal anyways, politicians should hold out for a better bill. The director of the ACLU's Washington office said the Senate needs to "substantially improve this bill" in line with the 2nd Circuit ruling, or else do nothing and let Section 215 expire. Other groups, like the Center for Democracy and Technology, still supports the bill as a good step forward.

Opponents seek more limits

Politicians who voted "no" took to Twitter and e-mail to explain their sentiments.

Rep. Justin Amash (R-Mich.) wrote a Facebook post explaining his view that the bill's definition of "specific selection term" is still too broad, and it won't stop mass surveillance.

"We need to repeal the #PATRIOTAct and start over," said Rep. Thomas Massie (R-Ky) on Twitter.

On the other side of the aisle, Rep. Ted Lieu (D-Calif.) agreed. "Our nation is better served by allowing Section 215 to expire completely and replacing it with a measure that finds a better balance" between security and civil liberties, he said in a statement.

"I won't compromise protection of basic fundamental privacy," wrote Rep. Earl Blumenauer (D-Ore.) on Twitter, who voted against the bill. "You deserve better."

On the Senate side, Sen. Patrick Leahy (D-Vt.) issued a statement saying the bill is a "true bipartisan compromise," which can't possibly satisfy everyone. "I would prefer more reforms as anyone can see from previous versions of the bill that I have introduced," Leahy said. "Other Senators would prefer more dragnet surveillance." Wyden's office said the bill is an "important step for protecting the privacy of Americans," and said he'll work in the Senate "to pass additional reforms."