WARSAW, Poland (AP) — Poland suddenly backtracked Wednesday on a disputed Holocaust speech law, scrapping the threat of prison for attributing Nazi crimes to the Polish nation — but leaving the possibility of fines in place.

The original law, which was passed five months ago, was presented as an attempt to defend the country’s “good name” — but mostly had the opposite effect. There was widespread suspicion that the true intent was to suppress free inquiry into a complex past, and the law was compared by some to history laws in Turkey and Russia.

The amendments were unexpectedly presented to lawmakers by Prime Minister Mateusz Morawiecki in the morning, passed with lightning speed in both houses of the legislature by the afternoon, and then signed by the president before nightfall.

“This small corrective strengthens our position, as we defend Poland’s good name, because during those few months we were able to awaken the awareness of many our partners, also in Israel,” Morawiecki said in defending the whole legislative effort.

The original version of the law had called for prison terms of up to three years for falsely and intentionally accusing the Polish nation of Holocaust crimes that were committed by Nazi Germany. The ruling Law and Justice party said it needed a tool to fight back against foreign media and politicians who have sometimes used expressions like “Polish death camps” to refer to German-run camps in occupied Poland. Even former U.S. President Barack Obama once used such terminology, causing deep offense.

Polish authorities insisted that nobody would be punished for any statement backed up by facts and that there would be no criminal punishment for discussing cases of Poles who denounced or killed Jews during the war.

But the law nonetheless sparked a major diplomatic crisis with Israel, where Holocaust survivors and politicians feared that it was an attempt to whitewash the episodes of Polish anti-Semitism. The United States warned the law threatened academic freedom and could harm Poland’s “strategic” relationships.

Ukraine strongly opposed the law as well because it criminalized denying atrocities committed by Ukrainian nationalists against Poles.

Those strained ties with its allies deepened Poland’s international isolation at a sensitive time of a bitter dispute with the European Union over rule of law.

Polish Holocaust scholars argued that the original law would have been useless against people outside of Poland and feared it was mostly meant to suppress a growing body of scholarly research about Polish violence against Jews.

The focus on the dark side of Polish wartime history is deeply unsettling to many Poles, who fear it has come to overshadow the heroic aspects of Poland’s resistance to Nazi Germany and the massive suffering inflicted on the country. During the war, nearly 6 million Polish citizens were killed — 3 million Jews but almost as many Christian Poles.

Israel’s Prime Minister Benjamin Netanyahu welcomed the amendments and issued a conciliatory joint statement with Morawiecki late Wednesday that expressed a common desire for dialogue and acknowledged many of Poland’s positions.

But Poland’s government will now have to face the anger of nationalist voters, who saw the original law as an attempt to defend national honor. Many feel that the nation’s dignity has been debased by the focus on Polish wartime anti-Semitism, which they see as pushing from view acts of Polish resistance against the Nazis and the help given to Jews by thousands of Poles.

One nationalist lawmaker, Robert Winnicki, described the changes as caving in to Jewish interests. He even tried to block the podium in the lower house in protest, but the vote went ahead anyway. Meanwhile, liberal opponents bitterly criticized the ruling party for introducing the law in the first place, calling it a disaster that had deeply harmed the country’s international position.

Morawiecki, the prime minster, argued that the legislation had still been a success because it had created greater global awareness of Poland’s wartime tragedy and heroism.

He described the joint declaration with Netanyahu as one positive result.

“We have defended the honor of our forefathers,” Morawiecki said. “This is a very good day for Poland, for Poland’s history.”

During difficult questioning in the Senate, he pushed back against the idea that Poland was doing the bidding of foreign interests and insisted that “nobody is writing our laws for us. This is a sovereign decision.”

The legislation keeps in place the possibility of lawsuits and fines for the same offenses. Morawiecki suggested Poland would use the law against any offending foreign media, saying they could face fines of even 100 million dollars or euros. It wasn’t clear how that would work in practice.

The dispute with Israel had sparked a wave of anti-Semitic comments in Poland — even by officials and state-run media commentators — as well as anti-Polish hate speech in Israel and elsewhere.

The joint Polish-Israeli declaration condemned both anti-Semitism and “anti-Polonism,” or prejudice against Poles, and Morawiecki welcomed the formal acknowledgement of its existence.

The law was never put into practice because the president had sent it to the Constitutional Tribunal for review, expressing some doubts about it.