President Trump briefly took aim Thursday at a key surveillance program despite his administration's official support for renewing it, suggesting the program was used to "badly surveil and abuse" his campaign based on the "phony" Trump dossier.

“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.

He was referring to the Foreign Intelligence Surveillance Act (FISA), which lets agencies collect information on foreign targets abroad. The House is voting Thursday on possible changes.

Trump's opposition, though, didn't last long. Later Thursday morning, he posted a follow-up tweet clarifying that he has sought changes to the law and voicing support for the surveillance program.

"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!" he tweeted.

It was an apparent attempt to get back on the same page with his own administration, which backs the so-called 702 program up for renewal in a House vote Thursday.

The White House on Wednesday had issued a statement opposing an amendment seeking to blunt some of the program's powers and shield communications of Americans who may get caught up in efforts to pick up foreign electronic communications.

“This amendment would re-establish the walls between intelligence and law enforcement that our country knocked down following the attacks of 9/11 in order to increase information sharing and improve our national security,” White House Press Secretary Sarah Sanders said in the statement. “The Administration urges the House to reject this amendment and preserve the useful role FISA’s Section 702 authority plays in protecting American lives.”

Section 702 of the FISA Act gives the government the ability to monitor electronic communications of foreigners outside of the U.S. Supporters say the powers help stop terrorist attacks and cyberattacks, but opponents note that it can also monitor the communications of Americans if they are communicating with monitored targets. The House bill before Congress would extend section 702 to 2021.

Former FBI director James Comey also weighed in Thursday, reflecting the views of many in the intelligence community that the program should be renewed. “Thoughtful leaders on both sides of the aisle know FISA section 702 is a vital and carefully overseen tool to protect this country. This isn’t about politics. Congress must reauthorize it,” he tweeted.

House Intelligence Committee member Rep. Jim Himes, D-Conn., blasted Trump's earlier tweet as "truly amazing," highlighting the disconnect with his own White House team.

"First, this is not true. Second, his national security people have been working like mad to get this passed. #owngoal," Himes tweeted.

Trump, though, has focused intently on the dossier in recent days, especially after a transcript was released of the congressional interview with the co-founder of the firm behind the document.

Republicans have long raised concerns that the dossier, written by a British spy and funded in part by the Democratic National Committee, was used by the FBI as justification to secure a FISA warrant and monitor members of the Trump campaign over concerns of collusion with Russian officials.

Trump had tweeted about the dossier earlier Thursday, declaring: “What a mess!”

He also answered questions Wednesday about allegations of collusion, calling the claims a “phony cloud” that has hurt the country.

“It's a Democrat hoax that was brought up as an excuse, for losing an election,” he said.

Fox News' Kristin Brown and The Associated Press contributed to this report.