Updated at 6:50 p.m. ET
The nation's top spy bosses scrambled to the White House early Thursday to urge President Trump to restate his support for a controversial surveillance law after he spent the morning trashing it on Twitter.
CIA Director Mike Pompeo, Director of National Intelligence Dan Coats, White House chief of staff John Kelly and national security adviser H.R. McMaster all convened in the Oval Office with the president to urge him to row back his criticism. House Speaker Paul Ryan, R-Wis., also joined in by telephone.
The men helped coach the president in wording the conclusion of a thread that began with a condemnation of the law that the president's administration supports.
The emergency meeting of the top national security officials and the House speaker was described by people familiar with the hasty conference.
Ryan and the spy service leaders implored the president not to undermine efforts to reauthorize the surveillance program known as Section 702 of the FISA Amendments Act, which was up for a vote in the House later in the day.
Trump's administration wanted lawmakers to pass the measure. The White House issued a statement in support of it on Wednesday evening. But hours later, when Trump viewed a TV report about Section 702 on Fox and Friends, he began posting on Twitter with complaints about it.
"'House votes on controversial FISA ACT today,'" he said in a tweet at 7:33 a.m. "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?"
When intelligence agency and congressional leaders saw that post, only hours before the scheduled House vote, they scrambled to urge Trump to follow up restating his official support.
Pompeo, Coats, McMaster, Kelly and Ryan tried to explain how the nation's intelligence and law enforcement agencies use Section 702 and how important it is to their work, according to an individual familiar with the matter.
Everyone in the meeting then helped come up with language for another tweet that Trump could send backing the program and urging lawmakers to reauthorize it. That's the second tweet the president sent from his Twitter account, the individual said.
"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!" Trump wrote.
The CIA and Office of the Director of National Intelligence declined to comment. There was also no immediate comment from the White House.
A U.S. official confirmed that Coats met with the president Thursday morning to explain the importance of Section 702.
"He was there before the second tweet went out," said the official, who asked not to be identified discussing sensitive intelligence matters. "He was one of the senior officials handling the FISA Section 702 issue."
The program permits U.S. spy agencies to collect the communications of foreign intelligence targets located overseas without a warrant. And if the National Security Agency is monitoring a foreigner in a foreign country who communicates with an American, the NSA can vacuum up the American's conversation without asking for authorization from a judge.
National security officials say it is a critical program used to protect the country from everything from terrorists to nuclear proliferation, while civil liberties advocates say it needs more privacy guarantees for Americans whose communications with foreigners are swept up by the program.
The nation's other top intelligence officials last year described Section 702 as their top legislative priority. Without it, they say, the U.S. would lose a critical tool used in the fight against terrorism, espionage, nuclear proliferation and cyberattacks.
The House ultimately passed the legislation on Thursday by a vote of 256 to 164. The bill still must pass the Senate, or the surveillance authority will expire next week.