WASHINGTON – If a House divided cannot stand, congressional Republicans may be in trouble.

A heated debate about the Foreign Intelligence Surveillance Act did not prevent the law’s reauthorization this week, but it has illustrated a significant divide among Republicans in both chambers of Congress.

FISA governs the collection of information about foreign entities suspected of espionage or terrorism. Although it was originally passed in 1978, it has since been repeatedly amended to adapt along with communications technology. Of particular concern is Section 702, which permits the government to collect digital communications — like text messages and emails — that pertain to a foreign actor in a searchable database.

Section 702 is opposed by digital privacy advocacy groups like the Electronic Frontier Foundation, which argues that the law allows the intelligence community to view communications among Americans as well as foreigners, and that officials may search the communications database without a warrant.

Supporters of reauthorization, including House Intelligence Committee chairman Devin Nunes, R-Calif., argue that Section 702 is a critical tool for homeland security. The reauthorization bill includes a provision requiring a warrant for the use of information obtained under Section 702 in certain criminal cases.

Libertarian-leaning Republicans see the bill as an unnecessary intervention into American privacy — and they are willing to work with some of the most liberal Democrats in Congress to fight it. Even so-called “establishment” Republicans produced two very different versions of the bill, indicating significant disagreement about how far FISA should go.

This divide may be a perennial thorn in the side of GOP leadership as the party attempts to pass legislation governing issues like privacy, national security and surveillance. Intraparty conflict may also be worrying to Republican leadership as both the House and Senate work frantically to pass a budget in the next day or two. If they fail, a government shutdown may be imminent.

FISA was last reauthorized in 2012. In the intervening years, however, the revelation of the Edward Snowden leaks brought the United States intelligence apparatus under renewed and vigorous scrutiny. As a result, some Republicans say that simply reauthorizing FISA will endanger the privacy of Americans.

In the House, 45 Republicans voted against reauthorization, among them many members of the House Freedom Caucus, a group of conservative lawmakers who released their own statement blasting the FISA reauthorization in the days before the House vote last week. “Government surveillance activities under the FISA Amendments Act have violated Americans’ constitutionally protected rights,” the Caucus board said in its statement.

Even some Republicans who ultimately voted “yes” on the bill had publicly expressed major reservations in the days before the vote. An alternative reauthorization bill put forward by the House Judiciary Committee would have imposed stricter limits on the intelligence community’s ability to search the communications database.

Committee chairman Rep. Bob Goodlatte, R-Va., previously said in a statement that only the Judiciary Committee version was “the only bill that protects both national security and Americans’ civil liberties.” Despite this, however, Goodlatte ultimately voted for Nunes’s bill.

The Senate approved FISA reauthorization by a 65-34 vote on Thursday. A bipartisan group of senators, including Rand Paul, R-Ky., Steve Daines, R-Mont., and Elizabeth Warren, D-Mass., planned to filibuster the bill, but the Senate passed a cloture vote, 60-38, on Tuesday night, preventing the possibility of a filibuster.

As the cloture vote passed, Rep. Justin Amash, R-Mich., a member of the House Freedom Caucus, attacked Senate Majority Leader Mitch McConnell, R-Ky., on Twitter.

“Like many other congressional leaders, your effort has been to misdirect and mislead on FISA 702,” Amash wrote on Tuesday. “American data is swept into government databases, and it is searched without a warrant. You know that, but you don’t want to talk about that, because you lose that debate every time.”

The intraparty confusion was complicated just before the House voted Thursday by a tweet from President Trump that contradicted previous White House statements in support of FISA reauthorization. “’House votes on controversial FISA ACT today,’” he tweeted. “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?”

A few hours later, the president appeared to reverse course. “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,” he tweeted. “We need it! Get smart!”

Intraparty squabbles cost Republicans their promised repeal of the Affordable Care Act. As the party begins to pursue its legislative goals in 2018, it is clear that these divisions are as significant as ever.