An amendment designed to allow the government warrantless access to internet browsing histories has been narrowly defeated in the Senate.

The amendment fell two votes short of the required 60 votes to advance.

But the effort is far from dead. Majority leader Sen. Mitch McConnell (R-KY), who switched his vote at the last minute, submitted a motion to reconsider the vote following the defeat.

Sen. John McCain (R-AZ) introduced the amendment as an add-on to the commerce, justice, and science appropriations bill earlier this week. McCain said in a statement on Monday that the amendment would "track lone wolves" in the wake of the Orlando massacre, in which Omar Mateen, who authorities say radicalized himself online, killed 49 people at a gay nightclub in the Florida city.

The amendment aims to broaden the rules governing national security letters, which don't require court approval. These letters allow the FBI to demand records associated with Americans' online communications.

If the amendment becomes law, federal agents won't need a court order to access phone logs, email records, cell-site data used to pinpoint locations, as well as browsing histories of recently visited websites.

In other words, the FBI will be able to tell where and when a user logged in and out of a website, including social media sites.

While the Obama administration was pushing for the amendment, privacy groups and tech companies -- including Google and Microsoft -- opposed the amendment.

The ACLU said in a letter to lawmakers that its concerns for the amendment are "compounded by the government's history of abusing the [national security letter] statute."

The statute was found unconstitutional in 2013, but was appealed by the government.

Sen. Ron Wyden (D-OR), a civil liberties and privacy advocate, was against the effort, arguing that the amendment was "not making the country safer, but threatening our liberty."

"Due process ought to apply as it relates to guns, but due process wouldn't apply as it relates to the internet activity of millions of Americans," said Wyden.

The comment was in reference to a vote on gun control measures in the wake of the massacre, said to be the worst mass shooting in living memory.

All four measures were rejected by the Senate earlier this week.