WARSAW At the sound of a bell from the altar, relayed over loud-speakers, about 50,000 people at an open-air mass last month in the Polish capital dropped down to kneel in the street.
It was a powerful symbol of Poland's deeply felt Roman Catholicism, a reminder of the scenes in the 1980s when, inspired by Polish Pope John Paul II, people prayed in the streets and brought down Communist rule.
But modernity intruded on this recent moment of spiritual contemplation. The size of the crowd meant some worshippers, who arrived late, had to listen to the mass standing outside a sex shop with signs in the window offering "exotic dances".
Society in Poland is changing and with it, the relationship between the Polish people and the Catholic church.
In this country where, since the end of Communist rule, prime ministers have sought the blessing of the church before making important decisions, Catholicism is losing its influence.
Opinion polls show that the number of people who go to church or pray regularly is in decline.
And now a series of initiatives - on in-vitro fertilization (IVF), ending state subsidies for the church, and homosexuality - is challenging Catholicism's role at the heart of the state.
"We want to separate the secular state from religion," said Andrzej Rozenek, a lawmaker with the ultra-liberal Palikot movement. It surprised many by becoming the third biggest party in parliament in an election last year.
"We're trying to show Poles that there are other values."
The changes have even reached the holiest place in Poland, the city of Czestochowa, 250 km (150 miles) south of Warsaw.
A shrine on a hill overlooking the city houses the Black Madonna, an icon of the Virgin Mary. It is famous for the slash marks on its cheek that were left, according to legend, by 15th-century Christian raiders fighting the Catholic hierarchy.
On a weekday afternoon, scores of pilgrims filed into the chapel at the centre of the shrine where, in silence, they strained to get a view of the icon.
Krzysztof Matyjaszczyk, the 38-year-old mayor of Czestochowa, upset this atmosphere of religious devotion by proposing something radical for Poland: to allocate city cash to pay for local couples to have in vitro fertility treatment.
The procedure is opposed by the Catholic church on the grounds that it departs from the natural order of procreation.
"There is certainly not a small number of people who don't like this initiative," the mayor said in his office, decorated with trophies from one of his hobbies, speedway racing.
Matyjaszczyk calls himself a "politician of the younger generation". As he sees it, he is simply doing what is right for a modern, European society, not picking a fight with the church.
"Let's look at this topic not as an ideological, political discussion but as a situation in which one group of people need help and another group has the mechanisms to help them," he said. "You can either do it and help them or hide your head in the sand and pretend there is no problem.
"I don't run away from problems. I am trying to face them."
Monsignor Jozef Kloch is spokesman for the Polish Bishops' Conference. At the building in Warsaw where he works, a nun in a wimple greets visitors before allowing them into the lift.
Up in his office, Kloch is scathing about the IVF initiative in Czestochowa, calling it "playing in politics, nothing more".
Poland's ties with Catholicism are rooted deep in history, but were given a fresh intensity by Karol Wojtyla, a clergyman in the city of Krakow before he became Pope John Paul II.
During a visit to his homeland, in 1979, the new pontiff gave a sermon at a mass in Warsaw. Poland was run by an unpopular Communist leadership that crushed dissent.
"May Your Spirit descend and renew the face of the earth," the pope said in a prayer. He made a dramatic pause, and then added: "The face of this land."
His message was clear. A year later a strike wave spawned the Solidarity movement, headed by Lech Walesa, which ultimately renewed Poland by bringing down Communist rule a decade later.
Today, the suite of rooms where President Bronislaw Komorowski receives visiting heads of state includes a Catholic chapel. Ninety-three percent of Poles identify themselves as Catholics. Many church services are packed.
Yet people have become less assiduous about their faith. In this, Poland is following the same pattern as countries like Spain and Italy, which grew less religious as they grew richer.
Since 2005 the proportion of Poles who pray every day has fallen from 56 percent to 38 percent, according to pollster CBOS. Though still high by European standards, the numbers who take part in a religious service at least once a week fell over the same period from 58 percent of Poles to 52 percent.
Blazej Modelski, 21, a maths student from Szczecin in western Poland, said he used to go to church as a child but now he only goes for his friends' weddings.
"Young people are more independent nowadays, they try to control their fates, and they don't need the whole surroundings: the rituals, visiting church every week, learning the prayers by heart," he said. "I can't see deeper meaning in it."
Aleksandra Miszczak, a student at Warsaw University, said she tried to practice her faith but struggled with the church's position on issues such as partnerships between homosexuals.
"I have many friends among them and I don't get it," she said. "Why should they be discriminated against, if they love each other the same as I love my boyfriend?"
The new, more secular Poland is provoking a fierce backlash from conservatives. At the open-air mass in Warsaw, the congregation was made up of trade union activists and supporters of the conservative Law and Justice opposition party.
"When will Poland stop acting like a monkey and imitating the West? I'm talking about all these gays and lesbians," said a middle-aged worshipper who gave his name as Stanislaw, holding a portrait of Christ. "Only Jesus can save Poland."
Whatever conservatives think, however, changes in the way the state relates to the church are becoming reality.
Michal Boni, Poland's Minister of Administration and Digitisation, is overseeing one of these shifts - a reform of the way the church is financed.
Under the system now, the state pays the Catholic church about 20 million euros ($26 million) a year toward its costs and covers pensions and healthcare for priests. Other faiths also get cash. Boni's plan is to scrap this and instead give citizens the option of paying up to 0.3 percent of their taxes to their chosen faith, a move the church fears would cut its income.
"This is not designed to be against the church," Boni told Reuters. "It is not about savings, but about a change of philosophy. I describe it as a friendly separation. The citizens should take decisions here; this is not the state's domain."
Several EU states, including Germany and Italy, use the tax system to let people channel funds to religious organizations.
The church accepts the principle of the reform, but says it needs not less than 1 percent of peoples' taxes, otherwise it will have to stop providing services to the poor and sick.
"I hope that we will meet in the middle," said Monsignor Kloch of the Bishops' Conference. "The government says only 0.3 percent and nothing more, but we are still negotiating."
Adam Bodnar is involved in another battle with the church, this one over homosexuality.
A lawyer and deputy president of Poland's Helsinki Foundation for Human Rights, he has been challenging in the courts rules which say same-sex couples do not have the same rights as male-female couples.
Every Polish court has rejected his challenge, but the campaign has, he said, helped shift attitudes.
"We have a member of parliament who is openly gay and is accepted by a big section of society; we have a deputy who is transgender," said Bodnar. "These discussions are completely different than they were before."
Abortion has proved an exception to the trend. There are tough restrictions on when a pregnancy can be terminated and polls show little appetite for easing them. This, though, may be linked to worries about falling birth rates as much as it is about church doctrine.
Rozenek, of the liberal Palikot movement, said his party would take its secularizing battle to a new front: the large wooden crucifix that hangs over a door in the debating chamber of the Sejm, the lower house of parliament.
He said his party will go through the courts to have it removed - and if that does not work, he and his party colleagues may physically take it down: "It's about ... being a secular country," Rozenek said.
Yet when he spoke about how religion affects his personal life, this fiercely anti-clerical politician made a frank admission: his children were baptized into the Catholic faith, because his wife insisted on it.
"It's a problem for me," he acknowledged.
Despite the profound changes under way in Polish society, Catholicism still runs deep.
(Additional reporting by Marcin Goettig, Rob Strybel, Grzegorz Szymanowski, Patrycja Sikora and Dominika Misiak; Editing by Alastair Macdonald)