This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

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.

And then Trump tweeted.

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.

“‘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!”