WASHINGTON (AP) — The Senate came one vote short Wednesday of approving a proposal to prevent federal law enforcement from obtaining internet browsing information or search history without seeking a warrant.

The bipartisan amendment won a solid majority of the Senate but just shy of the 60 votes needed for adoption. The 59-37 vote to allow such warrantless searches split both parties, with Republicans and Democrats voting for and against.

The amendment’s authors, Democratic Sen. Ron Wyden of Oregon and Republican Sen. Steve Daines of Montana, have long opposed the expansion and renewal of surveillance laws that the government uses to track and fight terrorists. They say the laws can infringe on people’s rights.

“Should law-abiding Americans have to worry about their government looking over their shoulders from the moment they wake up in the morning and turn on their computers to when they go to bed at night?” Wyden asked. “I believe the answer is no. But that’s exactly what the government has the power to do without our amendment.”

The amendment vote came as the Senate considered renewal of three surveillance provisions that expired in March before Congress left due to the coronavirus pandemic. The legislation is a bipartisan, House-passed compromise that has the backing of President Donald Trump, Attorney General William Barr and House Speaker Nancy Pelosi, D-Calif. It would renew the authorities and impose new restrictions to try and appease civil liberties advocates.

Senate Majority Leader Mitch McConnell, R-Ky., encouraged senators to vote against Wyden and Daines’ amendment, saying the legislation was already a “delicate balance.” He warned changing it could mean the underlying provisions won’t be renewed.

“We cannot let the perfect become the enemy of the good when key authorities are currently sitting expired and unusable,” McConnell said on the Senate floor before the vote.

The House passed the compromise legislation shortly before the chamber left town two months ago. But McConnell couldn’t find enough support to approve the measure in the Senate, and instead passed a simple extension of the surveillance laws. Pelosi never took that legislation up, and McConnell is trying again to pass the House bill this week.

“The attorney general and members of Congress have worked together to craft a compromise solution that will implement needed reforms while preserving the core national security tools,” McConnell said. “These intense discussions have produced a strong bill that balances the need for accountability with our solemn obligation to protect our citizens and defend our homeland.”

It’s unclear if McConnell will be able to get the votes for final passage on Thursday. The close outcome on the Wyden and Daines amendment indicates that a majority of the Senate would like to see the House legislation changed to better protect civil liberties.

An aide to Sen. Patty Murray, D-Wash., said after the vote that she would have supported the amendment if she had been present — meaning it would have passed. Murray was in her home state and will be present for Thursday’s vote, said the aide, who declined to be identified and was granted anonymity to share the senator’s thinking.

Julian Sanchez, a senior fellow at the Cato Institute, a think tank, said it was striking that the amendment failed by only one vote and said the vote total would have been “inconceivable” five years ago.

“It suggests a sea change in attitudes” following revelations in problems with how the FBI has used its secret surveillance powers, Sanchez said. “It goes to the sort of collapse in trust in the intelligence community to deploy these authorities in a restrained way.”

The Senate did adopt a amendment by Republican Sen. Mike Lee of Utah and Democratic Sen. Patrick Leahy of Vermont that would boost third-party oversight to protect individuals in some surveillance cases. If the Senate passes the legislation with that amendment intact, the bill would then have to go back to the House for approval instead of to the president’s desk for signature.

A third amendment by Kentucky Sen. Rand Paul, a Republican who is a longtime skeptic of surveillance programs, is expected to be considered Thursday before a final vote. Paul’s amendment would require the government to go to a traditional federal court, instead of the secretive Foreign Intelligence Surveillance Court, to get a warrant to eavesdrop on an American.

The expired provisions of the Foreign Intelligence Surveillance Act allow the FBI to get a court order for business records in national security investigations, to conduct surveillance on a subject without establishing that they’re acting on behalf of an international terrorism organization and to more easily continue eavesdropping on a subject who has switched cell phone providers to thwart detection.

The congressional debate coincides with internal efforts by the FBI and Justice Department to overhaul its surveillance procedures after a harshly critical inspector general report documented a series of problems in the FBI’s investigation into ties between Russia and the 2016 Trump campaign.

The report identified significant errors and omissions in applications that were submitted in 2016 and 2017 to monitor the communications of former Trump campaign adviser Carter Page.

The Justice Department inspector general has since said that it has identified additional problems in applications. The FBI has announced steps designed to ensure that the application process is more accurate and thorough, and that information that cuts against the premise of the requested surveillance is disclosed to the court.

With encouragement from Barr and congressional Republicans, Trump has said he will support the House-passed legislation. But Paul has made it clear that he will try and lobby the president to veto it, if it passes the Senate.

“You are the president of the US, and you’re allowing your intelligence community to spy on your political opponents?” Paul tweeted at Trump on Tuesday. “I’d be surprised if President Obama didn’t know about the abuses that occurred against @realDonaldTrump! We need to fix FISA now so it never happens again!”

Copyright 2020 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.