(CNN) The House of Representatives passed legislation reauthorizing the Foreign Intelligence Surveillance Act, which is a key tool of the US intelligence community, despite President Donald Trump's tweeted criticism of the government's surveillance program.
The vote was 256-164. It now goes to the Senate for consideration.
House Republican leaders and top administration officials believed early Thursday morning that they were in good shape to pass the plan, even though it faced opposition from the right and the left and is always a heavy legislative lift.
The President's tweet at 7:33 a.m. ET that questioned the already contentious program came at the worst time for GOP leaders who spent recent weeks rounding up the votes and combating demands for changes from conservatives and libertarian elements of the conference. The White House and law enforcement agencies have also been working the Hill and securing support from both sides of the aisle.
RELATED: Trump's FISA tweets throw Washington into chaos
"'House votes on controversial FISA ACT today.' This is the act that may have been used, with the help of the discredited and phony Dossier, to so badly surveil and abuse the Trump Campaign by the previous administration and others?" Trump tweeted.
House Speaker Paul Ryan and Trump spoke following his first tweet on FISA, according to a source familiar. A separate source confirmed that Trump initiated the call.
House Minority Leader Nancy Pelosi, on the House floor, at one point urged lawmakers earlier on Thursday to send the bill back to committee and make more changes. A senior Democratic source tells CNN Pelosi also called Ryan and urged him to pull the bill in light of the President's tweet. Pelosi announced shortly thereafter that she would support the bill.
As part of the negotiations with conservatives, Republican leaders allowed one amendment with the changes the bill's opponents wanted to get a vote -- with the assumption it would fail but would at least give these members the chance to say they got something. And the White House statement Wednesday night going on record against that amendment was a further effort to make it clear Trump supported the bill and not the effort to kill it with major changes. That amendment failed Thursday morning following comments Ryan made saying its passage would kill the overall bill.
At 9:14 a.m. ET, the President, in a tweet, appeared to walk back his earlier criticism, tweeting, "With that being said, I have personally directed the fix to the unmasking process since taking office and today's vote is about foreign surveillance of foreign bad guys on foreign land. We need it! Get smart!"
Shortly after the House vote on the amendment, Sen. Rand Paul, a Kentucky Republican known for libertarian stances on surveillance issues, reiterated his threat to filibuster the bill on the Senate side.
"No American should have their right to privacy taken away! #FILIBUSTER" he tweeted.
Paul has been leading an effort, alongside Sen. Ron Wyden, an Oregon Democrat, for his own amendment in the Senate, which has a little over a dozen senators from both parties as co-sponsors.
Ahead of the House vote Thursday morning, other senators were largely in favor of reauthorization, though some acknowledged there was debate over whether it should be reformed.
"We've got to renew. Question is do we change it or not. I was confused by those tweets as well," said Sen. Jeff Flake, an Arizona Republican.
California Democrat Sen. Dianne Feinstein told reporters that she hasn't seen the President's tweet on FISA, but said it preserves a very important data collection tool.
This story has been updated and will continue to update with additional developments.