A bill aimed at protecting the United States from cyber attacks failed to advance in the US Senate on Thursday, severely denting hopes for the passage of a measure backed by President Barack Obama.

The legislation was blocked amid opposition from an unusual coalition of civil libertarians — who feared it could allow too much government snooping — and conservatives who said it would create a new bureaucracy.

The bill needed 60 votes in the 100-member Senate to advance under rules in the chamber, but got only 52. The failure came despite pleas from Obama and top US defence officials.

After the vote, the White House blamed “an overwhelming majority of Senate Republicans” for blocking the bill, which it said would have protected the nation “from potentially catastrophic cyber attacks’’.

The bill was a “comprehensive piece of cyber security legislation” but it was foiled by “the politics of obstructionism, driven by special interest groups seeking to avoid accountability,” it said in a statement.

General Martin Dempsey, chairman of the Joint Chiefs of Staff, said the bill was needed to protect infrastructure critical to safeguarding national defence.

“Because the military relies on this infrastructure to defend the nation, we cannot afford to leave our electricity grid and transportation system vulnerable to attack,” Dempsey said in a letter to senators this week.

The revised measure had removed some parts of a bill passed in April in the House of Representatives that previously provoked controversy.

It called for a National Cybersecurity Council to assess vulnerabilities and would create a voluntary system of reporting attacks.

But Matt Kibbe of the conservative group FreedomWorks said the bill was “deeply flawed and would stifle innovation on the Internet’’.

He said that by allowing the Department of Homeland Security to define what amounted to critical infrastructure it would “create a completely open-ended regulatory apparatus for Internet security’’.

A campaign launched by civil liberties groups argued that the bill “would let companies like Facebook and Google monitor our online communications and then pass that data to the government without a warrant’’.

The US Chamber of Commerce argued that the bill “could actually impede US cybersecurity by shifting businesses’ resources away from implementing robust and effective security measures and towards meeting government mandates.”

comment COMMENT NOW