A Jewish man who was slain in the San Bernardino massacre had a heated argument with the gunman about Islam being a violent religion just two weeks before the shooting that killed 14 and wounded 21.

Nicholas Thalasinos, a devout Zionist, became furious with Syed Rizwan Farook, a fellow restaurant inspector, during work, declaring that the Muslim man “doesn’t agree that Islam is not a peaceful religion.”

Farook shot back that Americans don’t understand Islam, to which Thalasinos responded by saying, “I don’t know how to talk with him,” according to Kuuleme Stephens, a friend of Thalasinos’ who told The Associated Press that she heard the exchange while talking with him on the phone.

On the night before he was slain, Thalasinos — who maintained a Facebook page filled with anti-jihadi barbs — warred online with a Muslim fanatic who threatened to kill him.

“My new hobby appears to be BLOCKING PAGAN ANTI­SEMITIC TROGLODYTES so I’m just passing this along to warn others,” Thalasinos posted.

His online adversary Tuesday night was a Ukrainian who posted as “Med Ali Zarouk” and who had drawn Thalasinos’ ire with an anti-Semitic rant.

“You will never sucsseed [sic] to make a country for jews,” the Ukrainian had written, “because you are criminals and cowards . . . soon you’ll get your ass kicked, you will die and never see israel as country believe me never.”

The next morning, Thalasinos, a San Bernardino County restaurant inspector and father of two adult children, was shot dead by Farook, who had been in contact with Islamic extremists on social media.

Thalasinos’ widow, Jennifer, told The Post she considers her slain husband — whom she called “anti-Muslim” — a martyr.

“He knew Syed. He worked with him,” Jennifer Thalasinos, 41, told The Post outside her home in Colton, Calif.

“And he never had anything bad to say about [Syed],” she said.

“He knew he was Muslim, and with our faith, they may not necessarily have got along.”

But Jennifer also said she believed Farook may have been radicalized “behind the scenes” in the years before Wednesday’s mass shooting but wasn’t showing “that part of himself” at work.

If Farook had shown his true colors, “my husband would have had something to say,” she said.

As for initial reports that Farook argued with an unidentfied co-worker at an office holiday party moments before returning with his wife and weapons, Jennifer said that worker could well have been her husband.

“I’m sure everybody has seen his Facebook page. He’s very outspoken about Islamic terrorism and how he feels about politics in the state of the country,” Jennifer explained. “So I’m sure he probably had plenty to say to him.”

The year 2013 was a turning point for both Farook and Thalasinos. That year, Farook went on a hajj, the pilgrimage to Mecca in Saudi Arabia that is required of all Muslims.

That same year, the widow said, Nicholas became a “born again” Messianic Jew, devoting himself to Jesus.

“He wanted to serve the Lord and bring more people to the Lord,” Jennifer said.

Nicholas’ posts from that year are filled with anti-Islamic vitriol.

“On behalf of this guy . . . You can stick your Million Muslim March up your asses,” Nicholas posted on Sept. 11, 2013, with a photo of an office worker plummeting to his death from the blazing World Trade Center on 9/11.

A post from October 2013 also included a photo of a man falling to his death from the trade center. Above it, Nicholas posted the quote and attribution: “ ‘The sweetest sound I know is the Muslim call to prayer’ — Barack Hussein Obama.”

References to Israel and “turbanheads” began to fill Nicholas’ pages. Under “Education,” he listed on Facebook, “Studied Conservatism at Limbaugh Institute of Advanced Conservative Studies.”

Religion also played a big part in the life of another massacre victim, Michael Raymond Wetzel, a father of six who worked as a supervisor for San Bernardino County’s Environmental Health Services.

“Please pray,” his wife, Renee, posted on a message board Wednesday night. “My husband was in a meeting and a shooter came in. There are multiple people dead/shot. I can’t get a hold of him.”

Renee and Wetzel’s ex-wife, Amy, waited hours before learning that he was one of the 14 victims.