WASHINGTON – Over objections from law enforcement officials, the Senate Judiciary Committee has approved legislation that would require police to obtain a search warrant from a judge before they can review a person’s emails or other electronic communications.

The bill passed Thursday makes it slightly more difficult for the government to access the content of a consumer’s emails and private files from Google, Yahoo, Facebook and other Internet providers. Under the current law, the 1986 Electronic Communications Privacy Act, a warrant is needed only for emails less than 6 months old.

The committee chairman and the bill’s sponsor, Sen. Patrick Leahy, D-Vt., said digital files on a computer should have the same safeguards as paper files stored in a home. Americans “face even greater threats to their digital privacy, as we witness the explosion of new technologies and the expansion of the government’s surveillance powers,” Leahy said during the committee’s vote.

The full Senate, which is in a lame-duck session, is not expected to vote on the legislation until it reconvenes early next year. The Republican-led House Judiciary Committee hasn’t yet voted on a similar bill introduced by Democrats.

Passage of the bill comes just a few weeks after the stunning resignation of David Petraeus as the head of the CIA over an extramarital affair with his biographer, Paula Broadwell. The case focused the public’s attention on how easy it is for federal agents to access people’s email accounts.

Privacy advocates and civil liberties groups applauded the committee’s action, saying the law is outdated in an era of cloud computing, cheaper electronic storage, social networking and wireless phones. Such advances in technology have dramatically increased the amount of stored communications in ways no one anticipated a quarter of a century ago.

“We are very happy that the committee voted that all electronic content like emails, photos and other communications held by companies like Google and Facebook should be protected with a search warrant,” said Chris Calabrese, legislative counsel for the American Civil Liberties Union.

The Justice Department and other law enforcement groups had resisted changes to the law. The associate deputy attorney general, James Baker, urged the committee last year to consider the adverse impact on criminal and national security investigations if a warrant were the only means for law enforcement officials to obtain emails and other digital files.

Petraeus stepped down earlier this month after FBI agents examined messages between him and Broadwell. The FBI obtained a court order, signed by a judge, to read the contents of Broadwell’s email account before she was notified she was under investigation. Investigators also used grand jury subpoenas to obtain information about other electronic communications related to threatening messages she is accused of sending to a Tampa socialite.