Poland’s president, Andrzej Duda, has signed a legal amendment to decriminalise the false attribution to Poland and Poles of crimes committed by Nazi Germany during the Holocaust, signalling a partial retreat on contentious legislation enacted this year.

The legislation, which threatened prison terms of up to three years for any breaches, sparked a war of words between Polish and Israeli politicians and an outpouring of antisemitic rhetoric in Poland, as nationalist and pro-government media sought to portray the country as under attack from an international anti-Polish campaign orchestrated by foreign powers and Jewish advocacy groups.

The amendment was passed by both houses of the Polish parliament during emergency sessions on Wednesday, and means anyone who “publicly and against the facts” accuses the Polish state or nation of being “responsible or complicit in” Nazi crimes will be guilty of a civil rather than a criminal offence.

According to reports in the Polish press, MPs from Poland’s ruling Law and Justice party were made aware of the changes only when they were reported in Wednesday’s morning news bulletins.

On Wednesday evening the prime minister, Mateusz Morawiecki, and Israel’s prime minister, Benjamin Netanyahu, held press conferences to present a joint statement on the controversy, in which they emphasised their commitment to working together to resolve the differences.

“We believe that there is a common responsibility to conduct free research, to promote understanding and to preserve the memory of the history of the Holocaust,” said the statement. “We have always agreed that the term ‘Polish concentration/death camps’ is blatantly erroneous and diminishes the responsibility of Germans for establishing those camps.”

Netanyahu expressed satisfaction with the outcome. “We fulfilled our duty to safeguard the historical truth about the Holocaust,” he said.

Earlier on Wednesday, Morawiecki claimed his government had succeeded in its aim by raising international awareness of Poland’s role during the second world war, and he told MPs the courts could still fine those who broke the law.

“The purpose of this law was and still is one fundamental message: fight for the truth of world war two and postwar times,” he said.

“A publisher in the United States or in Germany will think twice before publishing today an article using the expression ‘Polish SS’, ‘Polish gestapo’ or ‘Polish concentration camps’ if he risks a lawsuit and a fine of 100m euros or dollars.”

In May the Guardian reported that staff at the Auschwitz-Birkenau memorial and museum in southern Poland had been subjected to a wave of “hate, fake news and manipulations” at the height of the controversy.

The legislation also appears to have placed great strain on Poland’s relationship with the US. There have been reports that the government was warned high-level contacts with US officials would be affected until the issue was resolved.

Some critics of the legislation argue that the government has not gone far enough to water it down. Further movement is still possible, however. Duda referred the legislation to the constitutional tribunal in February, expressing concerns about it even as he signed it into law. The tribunal has yet to make a ruling.