Trump tweet appears to attack NSA spying hours after the White House defends it.

Update: The House has passed legislation sponsored by Rep. Devin Nunes (R-CA) to extend NSA surveillance authority for six years without significant new privacy safeguards. The vote was 256 to 164. Most Republicans supported the legislation, but it wouldn't have passed without the support of 65 Democrats.

As recently as last night, the Trump administration was strongly in favor of legislation to renew one of the federal government's most controversial spying powers. Known to insiders as Section 702 of the FISA Amendments Act, the law grants the government surveillance powers that are only supposed to be used on targets outside the United States.

Civil liberties groups say that the law can too easily be used to sweep up the private communications of Americans. And they're backing legislation called the USA Rights Act to place new restrictions on the use of 702 spying powers—the House of Representatives was voting on that amendment as we published this story. Last night, the White House put out a statement condemning USA Rights.

"This Amendment will re-establish the walls between intelligence and law enforcement that the country knocked down following the attacks of 9/11 in order to increase information sharing and improve our national security," the White House argued.

Then Fox and Friends happened.

"I don't understand why Donald Trump is in favor of this," said Judge Andrew Napolitano in a Thursday morning segment of the show. "His woes began with unlawful foreign surveillance and unconstitutional domestic surveillance of him before he was the president of the United States. And now he wants to institutionalize this. Mr. President, this is not the way to go."

We don't know if Donald Trump was watching at that moment. What we do know is that less than an hour later, Donald Trump posted a tweet agreeing with Napolitano and seeming to contradict his own press operation from the night before.

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

— Donald J. Trump (@realDonaldTrump) January 11, 2018

Experts we talked to cast doubt on Trump's claim that his campaign was surveilled under FISA authorities. "There is no evidence FISA was used for political purposes," said Jake Laperruque, a surveillance law expert at the Program on Government Oversight.

But Laperruque said it is possible that some Trump campaign staffers like foreign policy advisor George Papadopoulos had their communications intercepted when they communicated with foreigners who were already under surveillance by the NSA.

Trump's national security advisors may have had a talk with him after that tweet because he partially walked it back a couple of hours later. "Today’s vote is about foreign surveillance of foreign bad guys on foreign land," he wrote. "We need it!"

Civil libertarians want new limits on government spying

Congress created section 702 with the 2008 FISA Amendments Act—the same act that gave telecom companies retroactive immunity for illegally spying on Americans at the behest of the Bush administration. It allows warrantless surveillance outside the United States even if one end of the communication is an American on American soil.

The provision was controversial, so Congress passed the law with a sunset provision. After a couple of extensions, that sunset is now scheduled to take effect later this month.

Laperruque says that at this point, few people want to repeal Section 702 outright. But civil liberties groups are worried about two controversial practices that could compromise the privacy of Americans. They've rallied behind the USA Rights Act, legislation sponsored by Rep. Justin Amash (R-MI) that would provide new limits for Section 702 spying authority.

One new limit focuses on "backdoor searches." The federal government is legally prohibited from using the broad surveillance powers of Section 702 to target Americans. Any surveillance effort must choose a target who is overseas. However, once the government has chosen a foreign target, it may intercept communications the target has with Americans. And the government saves many of these phone calls, text messages, emails, and other communications in a massive database.

A "backdoor search" occurs when the government then queries this massive database of already-collected communications for information related to an American subject. If the American has communicated with foreigners who were previously under government surveillance, that communication would be available to US intelligence or law enforcement agencies. The USA Rights Act would require the government to get a warrant before performing this kind of backdoor search.

The legislation would also prohibit "about" surveillance. The NSA's general surveillance approach is to monitor international communications at scale and save copies of communications that are related to surveillance targets. Traditionally, that means collecting communications where the sender or recipient is a surveillance target. But the NSA can also save messages where a surveillance target—like Vladimir Putin or ISIS leader Abu Bakr al-Baghdadi—is merely mentioned in communications between two people who are not themselves surveillance targets. That's "about" surveillance, and the USA Rights Act would ban it.

The politics of government surveillance are complicated

The Republican leadership in the House has supported legislation from Rep. Devin Nunes (R-CA) that would re-authorize Section 702 without new privacy safeguards. In the increasingly partisan House, you might think it was a foregone conclusion that that bill would pass. But Amash leads a significant faction of libertarian-minded Republicans who have bucked the White House view. Laperruque says they could number in the dozens—enough to deny the Nunes bill a majority using Republican votes alone.

That means that Democratic votes could be the deciding factor. Democrats have traditionally been more worried about civil liberties—and that's especially true under Republican administrations. Many Democrats will relish the opportunity to hand Trump a legislative defeat. But the Democratic caucus isn't unified either.

Yesterday, Laperruque told Ars that Adam Schiff, the top-ranking Democrat on the House Intelligence committee, is supporting the Nunes bill. That has discouraged Democratic leadership from trying to organize a unified front against extending Donald Trump's surveillance powers.

But this morning's tweets from Donald Trump could scramble the politics of the issue. His earlier tweet could give some wavering Republicans cover to defect and back the USA Rights amendment, while the fact that Trump is focusing on the issue could increase pressures on Democrats to vote against the White House. There's a good chance the intelligence agencies will get their way—they usually do—but today's votes are going to be exciting.