First Agnieska Markowska found a suspicious baptism certificate, then a trail of false names and invented hometowns. Hidden behind them was a Jewish family history her grandmother had sworn she would take to the grave.

“When I showed her what I had discovered, she still denied she knew anything,” said Markowska. So she made her way to Krakow’s Jewish Community Centre, the heart of resurgent Jewish life in a city that has long been more associated with Jewish tragedy.

“If my great-grandparents were Jewish, I wanted to know what they believed, what festivals they celebrated, how they lived. I exist because of them, and want to preserve their memory,” said Markowska, who now marks Jewish holidays herself.

The 45-year-old is part of a growing number of “third-generation” Polish Jews – they count back to the first generation of Holocaust survivors – who are rediscovering roots assiduously buried by parents and grandparents trying to escape death camps and then antisemitism, and helping to rebuild Jewish life in Poland.

Judaism has a history going back more than 1,000 years in the country, but because the Nazis carried out most of the murderous work of the Holocaust in occupied Poland, and reduced a population of more than three million to just a few thousand, many outside the country see it only as a site of Jewish death and suffering. Krakow was particularly notorious, with an infamous ghetto, and just an hour’s drive from Auschwitz.

“Many people in Israel have a very dark view of Poland,” said Kfir Katz, an Israeli with Polish roots who has settled in Krakow after months of research into family roots that allowed him to claim Polish citizenship.

His mother warned him the country her parents had fled was just a “vast cemetery”, but instead he found a community several hundred strong, four active synagogues, and a Jewish cultural festival that draws thousands of visitors each summer.

If some of the Jewish-quarter restaurants with Hebrew names sell pork dishes, there is also a better supply of kosher food than there has been for decades, and shabbat dinners are celebrated by open windows.

It was a slow journey, though, for the handful of Holocaust survivors who decided to stay on in the ruins of a city that was once home to more than 60,000 Jews.

“I was never in hiding, but I was never saying ‘Hi, I’m Henryk Meller, I’m Jewish,’ either,” said one community leader, who was born in 1931 and lost both parents and his only sister during the war. “My friends know, some of them are antisemitic. But that’s the thing in Poland, each antisemite has his own Jew who is his best friend.”

Poles are the single largest group on the Yad Vashem Holocaust memorial’s list of “righteous among the nations” in Israel, those who risked their own lives to save Jewish friends, neighbours, colleagues or acquaintances.

But prejudice also has deep roots. Many Polish Jews survived the Holocaust only because they had fled pogroms before the Nazis arrived. And within months of the liberation of Auschwitz, dozens more had died in new pogroms and fights over confiscated property.

In 1968, one faction within the communist government launched a cynical antisemitic campaign, as part of an internal power struggle, which cost hundreds of people their jobs and prompted thousands more to leave for Israel.

For decades there was not even a rabbi based in the city, said Meller, whose own son has immigrated to Israel. Meller never wanted to leave, and was key to the founding in 2008 of the Jewish Community Centre (JCC) in Krakow, a welcoming building which hosts everything from shabbat dinners and Torah study to make-up lessons and belly dancing.

Funded by UK charity World Jewish Relief, with support from Prince Charles, who opened it, it provides a meeting place for the existing community, but also somewhere for Poles who uncover a secret family history to explore Jewish culture, religion and history.

Olga Danek grew up in a house full of Jewish books and artefacts, and was taken several times as a child to Auschwitz and the spooky, deserted former Jewish quarter of Krakow. Still, she celebrated Christmas and Easter, and was stunned to be told, aged 12, “your grandmother was Jewish”.

“My first feeling when my mother told me I was Jewish was ‘OK, but maybe the community don’t want me’,” said Danek, now 28 and head of the student group at the JCC.

“You don’t have the papers, you don’t have the Jewish knowledge, what are you going to do? I think I was afraid, that I was not Jewish enough for them.”

In her group of 16 young Poles, only one grew up knowing she was Jewish. The rest share dramatic stories of deathbed confessions, fearfully guarded secrets or reluctant admissions drawn out after months of research in dusty archives. In many of their families Jewish identity in effect skipped a generation. Some Holocaust survivors lied to their children to protect them. Others, such as Danek’s mother, knew the family secret but felt it was too dangerous to acknowledge.

“She was born in 1961, and after 1968 we didn’t have an official Jewish life. You were told, ‘If you are Jewish you must go to Israel, you are not Polish’ – it was very difficult. I think she is afraid to be Jewish,” Danek says.

Pope John Paul II did much to tackle antisemitic attitudes, condemning them outright, visiting Auschwitz to pray in 1979, on his first visit to the country since becoming leader of the world’s Catholics, and forging high-profile relationships with Jews and Jewish communities.

The spectre still haunts Krakow, though. On a road near the JCC, a large piece of football graffiti reads Cracovia JG – or Krakow Jewish Gang, with a star of David. When Markowska told one friend that she was Jewish, the woman replied “Don’t worry, I will still like you”, and Danek’s mother frets about her wearing a star of David in public.

For Danek that lingering prejudice, and the long shadow cast by the horrors of the Holocaust, is just one more reason to celebrate Jewish life in Krakow.

“Many people think the Jewish community doesn’t exist here, and so it’s important to me to show that we do,” Danek said. “I want to show that we are not prisoners of the Holocaust. We are living here in Poland.”