Hours after President Donald Trump roiled the waters on Capitol Hill by criticizing a surveillance tool used by U.S. Intelligence, lawmakers in the House joined in a bipartisan vote to reauthorize part of the law which lets spy agencies gather information on overseas foreign intelligence targets.

The final vote was 256-164. The bill now goes to the Senate.

The trouble began for the plan after a morning salvo on Twitter, where the President said the Foreign Intelligence Surveillance Act "may have been used, with the help of the discredited and phony Dossier, to so badly surveil and abuse the Trump Campaign."

The tweet threw into doubt the carefully negotiated bipartisan legislation to extend Section 702 of the FISA law, which allows intelligence agencies to sweep up broad amounts of online communications in search of terrorism leads - critics say it amounts to nothing more than a warrantless search.

The criticism was all the more remarkable, because a day earlier, the White House had publicly announced support for the bill.

Two hours after his first tweet of the morning, the President issued a second FISA tweet walking back his criticism, saying the surveillance powers authorized by the bill are necessary.

"We need it!" he said.

Supporters of the bill were furious with the Presidential whiplash over FISA.

"While you can try to walk your tweet back, the damage is done," said Rep. Steny Hoyer (D-MD) in his own tweet aimed at the President.

The President's back and forth on FISA triggered uncertainty in both parties, and for a time this morning - actually endangered the bill's future, as both Republicans and Democrats balked at taking the vote.

"In light of the irresponsible and inherently contradictory messages coming out of the White House today, I would recommend that we withdraw consideration of the bill," said Rep. Adam Schiff (D-CA), the top Democrat on the House Intelligence Committee, in a House floor speech.

Schiff was backed up by House Democratic Leader Nancy Pelosi, who reportedly asked Speaker Paul Ryan to delay work on the bill.

But after the second tweet by the President - expressing support for the §702 FISA reauthorization - things calmed down, and the House moved to approve the plan.

Before approving the FISA reauthorization bill, the House voted down a plan from Rep. Justin Amash (R-MI), who joined other critics in arguing that new limits on that surveillance are needed, saying the current system allows warrantless searches on American citizens.

"In short, the base bill would give greater privacy protections to criminal suspects than to people the F.B.I. has no solid basis for thinking had committed any wrongdoing," Amash argued.

While the FISA §702 debate has been controversial for several years, the President's first tweet this morning picked up on a recent GOP theme, as some Republicans charge the Obama Administration used FISA powers to do surveillance on the Trump Campaign.

GOP lawmakers have also charged that a FISA warrant was approved for that surveillance based upon information in the "Trump Dossier," which was put together by an ex-British intelligence agent for the group Fusion GPS - which was paid in part by Democrats to dig up dirt on Candidate Donald Trump.

The details of any FISA warrant related to the investigation of Russian interference in the 2016 election has not been made public.