Germany is the dominant power in the bloc, and analysts say it is no coincidence that Poland’s nationalist government talks regularly about the crimes of World War II. For instance, it routinely brings up the idea of Germany paying war reparations, an issue that nearly all of the authorities consider settled as a matter of international law.

Critics say the new law pits two narratives of immense suffering against each other.

“It is understandable that Poles want people to know their story,” said Timothy Snyder, a Yale historian who lamented that few people know that the death toll in the failed 1944 Warsaw Uprising was higher than in the atomic bombing of Hiroshima, Japan.

“But the worst thing about a law like this is that it convinces you that you understand yourself,” Mr. Snyder added. “Your confidence in yourself grows as your knowledge of yourself goes down.”

There is a widespread feeling among many Poles — even those who oppose the governing Law and Justice Party — that the nation’s wartime experience, as victim and resister, has not been properly told and is not adequately understood. Invaded first by the Nazis and then by the Soviets, Poland and its people, gentiles and Jews alike, suffered immensely.

Prime Minister Mateusz Morawiecki has compared the Nazis to bandits invading a home shared by two families: If the bandits slaughtered one family and killed several members of the other, he suggested, how could the second family bear any culpability in the bandits’ crimes?

But nearly all scholars who have weighed in call that analogy dangerously simplistic.

Although many Poles risked their lives to save Jews, others energetically took part in pogroms, murdering at least 340 Jews in the town of Jedwabne in 1941 and 42 in the city of Kielce in 1946, after the war ended, to take two notorious examples. Still others extorted or betrayed their Jewish neighbors.