Police can be recorded secretly in Massachusetts when they're on official business in public, a federal judge ruled in Boston Monday.

The ruling is a victory for two Boston civil rights activists and the Project Veritas Action Fund, founded by the conservative activist James O'Keefe. The activists sued the Boston Police Commissioner and the Suffolk District Attorney over the issue in June 2016, and Project Veritas sued the Suffolk DA in Sept. 2017.

U.S. District Court Chief Judge Patti Saris ruled that using the 1968 Massachusetts wiretap law to criminalize secret audio recordings of government officials, including law enforcement officials, would be unconstitutional.

The Boston activists, Eric Martin of Jamaica Plain and René Pérez of Roxbury, sued for the right to secretly record police because they believe it "would both protect their safety and more accurately document police behavior," according to a press release issued by the American Civil Liberties Union of Massachusetts, who represented them.

“We’ve seen that videos of police officers can show the realities of policing in powerful ways: People’s recordings of police interactions have started national conversations about police reform and accountability,” said Carol Rose, executive director of the ACLU of Massachusetts, in a statement.

The Boston Police Department did not return a request for comment. The State Attorney General's office, which is defending the Suffolk District Attorney, said they are reviewing the decision.

O'Keefe is known for his sting operations that target liberals and journalists.

In the past, O'Keefe has carried out "sting" operations against a variety of organizations, including NPR in 2011. He first rose to prominence in 2009, when his undercover video of ACORN employees giving advice on tax breaks and home loans for a business involving underage El Salvadoran girls led to the group losing federal funding.

In their case, Project Veritas listed some topics they wanted to pursue with secret recordings: "landlords renting unsafe apartments to college students;" various government officials' opinions on sanctuary cities; "'protest management' activities by both government officials and private individuals related to Antifa protests;" and "interactions with Harvard University officials to research its endowment and use of federal funds."

Northeastern University Law Professor and WGBH Legal Analyst Daniel Medwed called Monday's ruling "notable in many respects."

“Perhaps most importantly, it's a significant step on the path toward police accountability," Medwed said, "because even though openly recording the police is permissible, it is the surreptitious secret recording of the police that might be most beneficial in thwarting potential misconduct.”

“Massachusetts is one of 11 states that have so-called two way consent recording laws," he said. "And this decision if it withstands scrutiny on appeal could provide precedent in other jurisdictions to allow greater secret recording of government officials including the police.”

Material from NPR was used in this report.