Opponents have accused Polish Prime Minister Beata Szydlo of making political remarks during a ceremony at the Nazi death camp at Auschwitz.
"In today's troubled times, Auschwitz is a great lesson that everything must be done to defend the safety and the lives of citizens," Ms Szydlo said.
The remarks were interpreted as defending her nationalist government's migrant policy.
But a government spokesman said they had been taken out of context.
A tweet highlighting the quote on the ruling Law and Justice party feed was deleted, when it prompted a series of critical responses.
The speech marked the 77th anniversary of the first Nazi transport of Polish prisoners to the Auschwitz-Birkenau Nazi German death camp. Among the 728 Poles sent to the concentration and extermination camp in June 1940 were political prisoners, soldiers, students and Jews.
But it came a day after Poland was among three countries targeted by the European Union's executive for refusing to accept its allocation of refugees under an EU solidarity plan. Poland had originally agreed to the plan but reversed its decision when Law and Justice came to power.
Several political opponents were critical of Ms Szydlo's remarks.
Donald Tusk, a former Polish prime minister who is now president of the European Council, complained that "such words in such a place should never come out from the mouth of a Polish prime minister".
Opposition centrist leader Katarzyna Lubnauer said Ms Szydlo had "exploited the cruelty of Auschwitz to make Poles afraid of refugees".
Government spokesman Rafal Bochenek urged critics to listen to the prime minister's entire speech. "If someone wants to, they will find bad intentions in any comment," he tweeted.
During the speech, Ms Szydlo paid tribute to the six million Poles who died in World War Two and spoke of the importance of passing on the truth of what had happened.
But her government has already been accused of trying to reinterpret the events of the war from a narrower, Polish perspective. Earlier this year it won a court battle to take over a new museum in Gdansk that presented the conflict from a global view.
Now it is also planning a museum near Auschwitz to mark Polish resistance to the death camp, built by the Nazis when they occupied Poland.
Most of the 1.1 million victims who died there were Jews, but Poles, Roma and others were also murdered.
The existing museum at Auschwitz-Birkenau includes the imprisonment and murder of Poles as well as the Jewish victims.
However, Deputy Prime Minister Piotr Glinski said the new museum would complement the existing one.