Among other changes, the proposed amendment would have required officials to obtain court warrants before hunting for, and reading, private emails and other messages of Americans that are swept up by the program that targets foreigners’ communications in counterterror and espionage cases.
The bipartisan coalition backing overhaul efforts — which includes some of the most conservative and most liberal members of the House — argued that change was necessary to uphold the meaning and substance of Fourth Amendment privacy rights in light of 21st-century communications technology and surveillance powers.
But the intelligence community and Trump administration balked at that proposal, saying it would impede their efforts to protect the country to require warrants to query information the government already possesses. House leaders also opposed the amendment.
Mr. Trump’s first tweet on the topic on Thursday appeared to encourage lawmakers to support limiting the law. The White House press secretary, late on Wednesday, issued a statement asking that lawmakers vote against it.
In his Twitter post, Mr. Trump was referring to an explosive and largely uncorroborated dossier that details claims about ties between Russia and Mr. Trump and his aides.
The tweet enraged Republican leaders on Capitol Hill who have been trying to chart a course to renew it, more or less intact, and left leaders in both parties scrambling to secure votes. Speaker Paul D. Ryan and Mr. Trump spoke by phone between the president’s two tweets, according to a Senior Republican congressional aide.
Representative Nancy Pelosi, the House Democratic leader, asked Mr. Ryan to pull the bill from consideration, according to a senior Democratic aide familiar with the request. But Republicans, battling a last-minute push from conservative lawmakers, gambled on moving forward with a vote.
Republican leaders in both the House and the Senate have been counting on enough moderate Democrats and Republicans to stick together to extend the legal basis for the surveillance program with only minimal changes.
The debate centered on an expiring law, Section 702 of the FISA Amendments Reauthorization Act, which permits the government to collect without a warrant from American firms, like Google and AT&T, the emails and other communications of foreigners abroad — even when they are talking to Americans.
Mr. Trump, who is known to watch Fox News while he is tweeting, posted his tweet that appeared to support limitations to the surveillance law, shortly after a Fox News legal analyst appealed directly to the president during a Thursday morning segment about the upcoming House vote. The analyst, Andrew Napolitano, turned to television cameras and said, “Mr. President, this is not the way to go.” He added that Mr. Trump’s “woes” began with surveillance.
By midmorning, in a follow-up tweet, the president appeared to step back from supporting the limits that his own administration has been encouraging lawmakers to reject.
Senator Mark Warner, the top Democrat on the Senate Intelligence Committee, said in a Twitter post that the president’s tweet was “irresponsible.”