WARSAW, Poland — As the most hated intellectual in Poland, Jan Gross contends with online abuse, government hostility and threats of prosecution.

So when the retired Princeton professor visits his homeland, he takes a small precaution — wearing a cap over his silver hair in public, to make himself a little less conspicuous.

Gross has triggered controversy for nearly two decades with works that explore Polish violence against Jews during and after the Holocaust. That does not make him popular in today’s Poland, where the nationalist government considers there has been an exaggerated focus on the country’s World War II sins and has embarked on a wide-ranging effort to keeps Polish heroism and suffering in center place.

The effort has included a new law imposing up to three years of prison on anyone who falsely accuses Poland of Nazi Germany’s Holocaust crimes.

Sometimes colloquially dubbed “Lex Gross” (Latin for the “Gross Law”) because it was inspired by anger against Gross, it has upset Israel and the United States, which consider it a threat to freedom of speech and academic inquiry.

While the government insists the law will not target anyone who tells the truth, the efforts to defend it to a skeptical world have been clumsy and accompanied by remarks that have seemed insensitive to the Jewish tragedy, bringing more attention to the very accounts authorities wanted to silence.

In a recent interview, Gross said the law has had the salutary effect of inspiring more discussions about Poland’s past, though he said education in schools is a much better way to achieve that goal. Despite calls for him to be prosecuted under the law, he believes its real aim is to “gag” the way history is written far more broadly.

“I am going to write what I am writing. But young people will think twice before they specialize in that field, and teachers and others will feel very constrained about speaking about and addressing issues of complicity and how the Holocaust played out in Poland,” Gross said.

Gross was born in Warsaw in 1947 as the destroyed city was rising from the rubble. His mother hailed from Christian gentry and had been active in the anti-German resistance, helping a Jewish man — Gross’s future father — to survive in hiding.

As a student at Warsaw University, Gross was active in a protest movement fighting censorship by the communist dictatorship in 1968. The regime crushed the student protesters and orchestrated an anti-Semitic campaign that forced thousands with Jewish heritage to flee. He was in Warsaw earlier this month for events marking the 50th anniversary of the 1968 persecution, and spoke to The Associated Press from the POLIN Museum of the History of Polish Jews, where an exhibition highlights the role of a young Janek Gross and his future wife and co-researcher, Irena Grudzinska, in those dramatic days.

Gross’s family, not feeling a sense of Jewishness or identification with Israel, settled in the United States. He got a doctorate in sociology from Yale and focused his early research on the persecution of Polish society under the German and Soviet occupations, getting a Polish Order of Merit for service to the nation.

Gross first challenged his homeland to confront its complicity in killing Jews with the publication in 2000 of “Neighbors,” a slim but explosive book about a massacre in the town of Jedwabne in 1941. Revelations that Poles — not Germans — clubbed Jews to death, decapitated and drowned them and then burned alive hundreds in a barn, were deeply shocking.

Poland was Hitler’s first victim, invaded from two sides, by Germany and the Soviet Union, forced to become the Holocaust’s main slaughterhouse, then betrayed by its Western Allies at the hour of victory, abandoned into Communist dictatorship. Just as it was finally a democracy, its people suddenly saw the nation cast as a villain.

While most Poles accept that some individuals behaved terribly, these culprits are widely seen as marginal criminals and blackmailers who do not represent the larger Polish response to the slaughter of the Jews.

Those who hate him most cast Gross as a Jew slandering the nation, and want him imprisoned. To Gross’s supporters, though, he is a moral voice of conscience.

He tells the story of a husband and wife who run a tiny, cramped kiosk where he buys newspapers during his regular visits to Warsaw from his home in Berlin. Recently they had one of his books waiting for him to sign, and they offered him shelter should he ever find himself in trouble.

“They tell me ‘be careful, but if you need to, you can come to our kiosk and we will hide you,'” Gross said.

There is also a middle ground of those who credit Gross with raising difficult questions but say he sometimes goes too far, for instance with a 2015 claim that Poles killed more Jews during the war than they killed Germans, something disputed due to a lack of firm statistics. Prosecutors have since been investigating whether he committed the crime of libeling Poland.

Critics also fault him for giving short shrift to the Poles who risked their own lives to save Jews, and for ignoring actions by Jews that might partly explain hostility toward them, for instance the welcome and collaboration by some Jews in eastern Poland under the Soviet occupation.

Dariusz Stola, the POLIN museum director, says he disagrees with Gross on a number of important questions, but still considers him the “leading figure for Poland coming to terms with the Holocaust — a past which many European nations need to face.”

When President Andrzej Duda signed the Holocaust speech law in February, the Israeli and American reactions were so sharp that he also sent it to the constitutional court for review, and authorities now suggest it might be struck down in part.

“These guys will wiggle their way out now,” predicted Gross.

He voiced pessimism, however, about the larger memory struggle under nationalist rulers.

“You talk about the Holocaust and the second sentence you will hear will be ‘Poles were helping Jews,’ or ‘Poles have so many trees at Yad Vashem.’ There is no conversation about the plight of Polish Jews,” Gross said. “Has that ever been in the history of any country that 10 percent of its citizens have been murdered in such an extraordinarily brutal way and this is not part of the country’s history?”