Montpelier — The Vermont House has approved a bill that would protect journalists from having to provide the identity and information obtained from confidential sources.

The so-called media shield bill would prevent a court, police, prosecutors or defense attorneys from requiring journalists to turn over information from confidential sources. The legislation provides limited protection for information from non-confidential sources.

The bill got preliminary approval on Wednesday with a smattering of no votes.

Rep. Anne Donahue, R-Northfield, was the only member to publicly speak against the bill.

It won final approval on the House floor on Thursday by a vote of 140-2. Donahue and Rep. Robert Frenier, R-Chelsea, were the two opposition votes.

The Senate already passed the measure unanimously last month. The next stop for the bill is the governor’s desk, where it is expected to get a signature.

Journalists testified that S. 96 was needed to protect sources, including whistleblowers, in an era when government officials are trying to crack down on leaks.

A proponent of the bill, Rep. Martin Lalonde, D-South Burlington, said shield laws are not just to protect journalists.

“The main goal in fact of such laws is to protect sources,” Lalonde said. “These sources may include whistleblowers, crime victims, accused criminals and others whose safety or lives might be threatened” by disclosure.

The Vermont Press Association and a coalition of journalists pushed the legislation after two reporters and an editor at Seven Days, a Burlington newspaper, were subpoenaed to testify last year in a sexual assault case filed against former Sen. Norm McAllister. Also, President Donald Trump threatened on the campaign trail to curb the First Amendment rights of reporters.

In Vermont, reporters have been threatened with jail if they didn’t comply with a court order to divulge information.

The bill provides an “absolute privilege” to not turn over information provided by confidential sources.