Since the fatal shootings of police officers in Texas and Louisiana, the Detroit police chief, James Craig, has been particularly on alert for social media threats against officers.

Craig made a “conscious decision” following the killing of five officers in Dallas to respond to threatening social media comments and “act on it quickly”, he said – despite acknowledging legal questions about whether these comments are protected by the first amendment.

So last week, Detroit police arrested four people for allegedly making online threats to kill police officers, including one man who called the Dallas shooter, Micah Johnson, a hero, and said he “inspired me to do the exact same thing”. A separate post specifically mentioned killing white police officers, Craig said.

Since the Dallas incident and the shooting that left three officers dead in Baton Rouge, police departments across the US are increasingly focused on threats made on social media, and in some cases pursuing criminal charges. The comments they are targeting are incendiary and violent. But experts caution that the cases exist in murky legal territory, threatening to test the line between what is known as a “true threat” and criminalization of free speech.

“While a true threat that endangers the community ought to be investigated, it’s important that people are allowed to freely express their protected opinions without the threat of prosecution,” said Stephanie Lacambra, a criminal defense staff attorney at the not-for-profit Electronic Frontier Foundation.

Craig said he plans to err on the side of protecting police, given recent events.

“While I might not be a lawyer, the thing I am clear on is what constitutes a threat to someone’s life. If you make a specific threat to kill someone, that’s specific enough for me,” said Craig. “I’m suggesting a police officer, in this environment today, faced with a threat, it should not be taken lightly.”

In the past few weeks, Craig said, his rank-and-file officers have unquestionably felt a heightened concern for their own safety. “Officers want to go home at night and, given the recent events, certainly everyone – including myself – we are concerned,” he said in an interview after a funeral on Tuesday for one of the Dallas officers.

“It’s important [for police] not to underreact but equally important not to overreact,” he added. “And when you’re well trained, and you’re vigilant in how you deal with situations in the field, it can minimize making a bad decision.”

In the Detroit case, none of the men have been identified, nor charged yet in connection with the posts. A spokesperson for the Wayne County prosecutor’s office, which covers Detroit, said felony warrant requests were submitted by police and remain under review. (Detroit police didn’t respond to requests for copies of the alleged social media posts.)

Other departments across the US have followed suit. Minneapolis police confirmed this week that they were investigating a statement posted in the comment section of a USA Today story about the Baton Rouge shooting. The Minneapolis-St Paul area in Minnesota has been mired in tense protests for days, after police in a nearby suburb fatally shot 32-year-old Philando Castile, a school cafeteria supervisor.

“I’m anxiously looking forward to the Minneapolis headlines when they come, and they, more than likely, will, people. More than likely will,” the comment under the newspaper’s story stated. Minneapolis police echoed Craig’s remarks, and said such potentially threatening posts should be investigated.

Balloons are released during a vigil for Louisiana’s fallen police officers in downtown Baton Rouge. Photograph: Jeff Dubinsky/Reuters

“This, and every other threat, has to be taken very seriously because of the recent attacks on officers,” Minneapolis police Sgt Catherine Michael told a local ABC affiliate.

Louisiana police arrested a 19-year-old man after he posted a video on social media while idling behind a police officer’s car. In the clip, the man brandished a handgun and mentioned recent police-involved shootings in the US, authorities said, while allegedly making threats against the officer ahead of him. The man turned himself in and was charged with public intimidation.

A day after the Dallas shooting, a 24-year-old Illinois woman was arrested and charged with disorderly conduct for allegedly posting on Facebook that she would shoot any police officer who pulled her over for a traffic stop and asked her to get out of her car.

Lacambra said more charges over online posts are likely forthcoming.

“I expect that these kinds of charges will increase in reaction to recent events as more people feel the need to weigh in on the issue of the intersection of race and law enforcement violence,” she said. But, she added, they may test the limits of who can be prosecuted.

Josh Wheeler, director of the Thomas Jefferson Center for the Protection of Free Expression, cautioned that while some of the statements made on social media may be “horrible”, the current state of the law on online threats is is uncertain and remains a “difficult issue”.

While the first amendment provides broad protection to comments online, it doesn’t cover what are known as “true threats”, Wheeler said. The problem is that courts haven’t settled what sort of intent is required to interpret something as a “true threat” rather than just protected speech.

Do prosecutors have to prove that the speaker intended to threaten the police? Or “is it sufficient that the prosecution prove that a reasonable person hearing or seeing this threat … would interpret them as threatening?” Wheeler said.

In a case before the US supreme court last year, Elonis v United States, the justices overturned the conviction of a man who wrote violent social media posts about his estranged wife. The court ruled that prosecutors must prove the defendant’s intent, and that a reasonable person would view the statements as a threat.

But the justices didn’t set a constitutional threshold, Wheeler said.

“They punted it,” he said. They made their decision by interpreting a federal law, not the constitution. “That’s what’s left open.”