THE window over the main door of the Bishop’s Palace in Krakow is known as the Pope’s Window. It was from here that John Paul II, born Karol Wojtyla, used to address his followers when visiting the city where he had served as archbishop during the communist regime. This week, a different pontiff is occupying the window. Pope Francis is in Poland for the church’s World Youth Day festival (actually a week, between July 25th and 31st), which is expected to draw over 1m visitors. Although the more conservative pope died in 2005, it is not clear whose is the greater presence. Asked by Polish television on Monday night about security at the event, a government official said there was a “pact with Holy Father John Paul II” to protect it.

Although Krakow is full of flags and outdoor stages, the Polish church itself is not so lighthearted. Catholicism is Poland’s dominant religion, and the church’s political ally, the nationalist Law and Justice party (PiS), has been running the country since November. Whereas Francis has suggested that perhaps gay people are not all wicked, PiS’s leaders insist that sexual deviation of all kinds is a threat to the nation. The pope’s visit is highlighting many Poles’ desire for priests who will listen, rather than judge. Yet it also shows the gap between a reformist pontiff and a Catholic country that has taken an illiberal turn.

Cultural politics in Poland do not fit a neat model of young liberals versus old conservatives. Over two-thirds of young Poles describe themselves as believers, though they go to church less than their parents do. True, the number of young atheists has doubled in a decade, and most young people think premarital sex is fine. But only one in five supports abortion on demand. Prejudice towards gay people lingers, too. In Krakow, one Youth Day volunteer calls homosexuality an “illness”.

The young are more hostile to refugees than their parents: over 80% of Poles aged 18-34 oppose taking them in, compared with 52% of those over 65. They are also more in favour of border controls within the EU. Many of the teenage pilgrims in Krakow say they fear a wave of “Islamisation” or “secularisation” from western Europe. (Oddly, they sometimes conflate the two.) The Pope is “great on faith but not on politics”, says a young street sweeper from Nowa Huta, an industrial area of Krakow.

Indeed, PiS came first among 18- to 29-year-olds in the elections last October. Beata Szydlo, the prime minister, has refused to take in refugees, citing security concerns. “Political correctness, abandoning the Christmas tree so as not to irritate Muslims—this has emboldened terrorists, too,” she said in a recent interview with wSieci, a conservative weekly.

Poland’s clerics have been at best lukewarm towards refugees. When Francis called on parishes to take them in last year, one Polish bishop likened them to “crusaders”, adding that “multi-culti has failed.” Whereas the Pope preaches openness, Polish clerics warn against “gender ideology” (a catch-all term for tolerance of sexual minorities) and in-vitro fertilisation. PiS has decided to suspend state funding for IVF.

Meanwhile, Pope Francis has become an icon for liberal Poles, Catholic or not. Slawomir Sierakowski, head of Krytyka Polityczna, a club of intellectuals, calls him the “leader of the left”. Many hope he can change the church. Polish Catholicism speaks a language of “homophobia veiled in a layer of mercy”, says Aleksandra, a young member of “Faith and Rainbow”, a group of Polish LGBT Christians. At the group’s hang-out on the sidelines of World Youth Day, a rainbow flag and a Polish flag fly side by side.

Poland’s religious landscape remains dominated by John Paul II, whom many still call “our pope”. Still, the unpretentious Francis, who planned to travel through Krakow by tram, is a breath of fresh air. On July 27th he urged a crowd to “take in people fleeing wars and hunger”, and called for “a climate of respect between all circles in society”. Even if Francis cannot soften Poles’ attitude to refugees, he may be able to help them talk to each other.