Moments before he opened fire in a Pittsburgh synagogue in October, Robert Bowers posted his last in a long series of anti-Semitic messages on social media.

“HIAS (Hebrew Immigrant Aid Society) likes to bring invaders in that kill our people. I can’t sit by and watch my people get slaughtered. Screw your optics. I’m going in,” he wrote.

Bowers had legally purchased over many years the four guns he used to kill 11 people at the Tree of Life Congregation Synagogue and six other firearms authorities found in his home.

Though boiling with hatred, Bowers didn’t fall into any category of person barred from gun ownership under federal law. He wasn’t a felon or a domestic abuser or dishonorably discharged from the military. He wasn’t declared mentally ill.

But it’s not hard to imagine how anyone in a position to grant Bowers the permits he may have needed to build his arsenal might have thought twice about doing so had the extent of his anti-Semitic screeds online been known.

That’s what a new bill in the state Senate seeks to do, by requiring anyone applying for a pistol permit or renewing one to consent to an investigation of their social media accounts and online search history by police.

More:Gun permit seekers would see social media searched under New York bill

Under the measure, police would be empowered to scour three years of an applicant’s social media activity on four websites or apps (Facebook, Instagram, Twitter and Snapchat) and a year’s worth of searches on Google, Yahoo and Bing.

To ensure unfettered police access, the measure demands that applicants hand over their passwords and log-in information.

Police would be required to look for evidence the applicant searched for or used racist or discriminatory language, threatened the safety of another person, inquired about or alluded to an act of terrorism, and, finally, “any other issue deemed necessary by the investigating officer.”

The bill, introduced by state Sen. Kevin Parker, a Democrat from Brooklyn, is well-meaning in that it seeks to protect the unalienable right to life that the Founding Fathers held to be self-evident in the Declaration of Independence.

In aiming to ward off mass murder, however, the measure runs roughshod over the Constitution’s right of free speech under the First Amendment, and the rights to privacy and freedom from unreasonable searches guaranteed by the Fourth Amendment.

Of course, it conflicts with the Second Amendment’s right to bear arms, too. But I don’t care much about that, and neither do a lot of people who are sick and tired of mass shootings, street violence, and suicides by gun.

Sixty-one percent of Americans think there should be stricter gun laws and 21 percent want to see the Second Amendment repealed, according to an Economist/YouGov poll conducted earlier this year. The same survey found that nearly half of respondents, 46 percent, would be willing to modify the Second Amendment to make it easier to regulate guns.

I do care about any chiseling away at the rights to speak our minds and to privacy. (Ironically, social media enhances our ability to do the former while eroding the latter.)

With the exception of threatening another person’s safety, social media posts — even about the most heinous of topics — aren’t an indication that someone intends to go on a shooting spree.

While it’s illegal to discriminate against others based on race, gender, sexual orientation and the like, and criminal to commit crimes motivated by prejudice, it’s neither illegal nor criminal to be a bigot.

New York’s gun-permit application process is already rigorous. It takes months, involves police interviews with people who know the applicant, and has safeguards in place to keep guns out of the hands of criminals and people with a history of violence and mental illness.

One would hope police doing the vetting are already reviewing the public social media posts of applicants to glean some additional insight on them. Anyone with internet access can do that. Accessing passwords and private conversations, though, is something different.

That’s presumably why the bill doesn’t have a sponsor in the Assembly. New Yorkers Against Gun Violence won’t even commit to endorsing the bill, which was introduced two weeks ago.

The advocacy group is backing a far more effective measure to stop mass shootings, however, in what’s known as the Extreme Risk Protection Order (ERPO) bill.

The bill enables families, household members and police officers concerned that a person might harm himself or others to petition a court directly for an order temporarily restricting that person’s access to guns.

That bill passed the Assembly earlier this year but stalled in the Republican-controlled Senate. With any hope, that will change when Democrats gain control of the chamber in January.

Enabling law enforcement to intervene when gun owners or would-be gun owners are in crisis — as opposed to subjecting all of them to an unconstitutional dragnet without probable cause or due process — is a far superior way to stop the next Robert Bowers.

David Andreatta is a Democrat and Chronicle columnist. He can be reached at dandreatta@gannett.com.