Prosecutors are eyeing an ?appeal to a higher court or even the state Legislature after a judge tossed a case of a man who authorities say took pictures of plainclothes officers in a courthouse so that he could identify them in the future.

The call for a new look at the controversial cases comes after fatal attacks on police in Dallas and Baton Rouge.

“Given the officer’s reasonable concern about the incident, a common-sense interpretation of the statute, the Trial Court’s own rules, and now the attacks on police in Texas and Louisiana, we’re reviewing this decision and statutes nationwide closely,” Suffolk District Attorney spokesman Jake Wark said. “If a higher court won’t take it up, then we may seek a legislative fix.”

Khyeme Johnson took out his cellphone at the downtown Boston Municipal Court and snapped photos of the Boston Police A-1 Drug Control Unit as they waited for a motion hearing in the hallway on Jan. 16, according to authorities.

The officers — who say they had seen Johnson acting as a lookout in the past — arrested him because they feared the photos “could potentially impede ?future investigations,” according to court documents.

One officer testified that he was afraid the photo would be circulated on social media, which could “jeopardize current investigations” and “the safety of myself in the future or my family ?or my partners’ safety or their families as well,” court documents state.

A grand jury indicted Johnson for witness intimidation, but Suffolk Superior Court Judge Peter Krupp dismissed the case because he found there was no specific intent to interfere with any present or future investigation.

“Simply interfering with pol?ice work, or making such work more difficult or more dangerous, however reprehensible, is not a crime under the witness intimidation statute,” Krupp wrote earlier this month.

Law enforcement decried the decision as an improper reading of the state’s witness intimidation statute.

“We respect the work of the judge in this case. However, we disagree with his interpretation of the statute and the application of the facts,” said Boston police spokesman Lt. Detective Michael McCarthy. “We wholeheartedly agree that simply ?interfering with police work or making it more difficult is absolutely reprehensible.”

Jeff Garland, Johnson’s attorney, said “police should not ?restrict our constitutional rights based on unfounded speculation about safety.

“Prosecutions like this one are a distraction from true ways of increasing safety,” he added. “At the end of the day, the people peacefully photographing or video-recording the police are not the problem.”