Madrid, Spain - Shortly after his election in 2004, Socialist Prime Minister Jose Luis Rodriguez Zapatero ended a quarter-century of cozy church-state relations by blocking mandatory religious classes in public schools. He then took wider aim, saying his government would relax abortion laws, ease restrictions on divorce, legalize gay marriage and permit gay couples to adopt children.
In response, the archbishop of Madrid called the Spanish capital "a hotbed of sin." Pope John Paul II accused Zapatero of "promoting disdain towards religion" and said the Catholic Church in Spain would never yield "to the temptation to silence it."
Things got particularly nasty when the media joined the fray. A radio station sent reporters into confessionals with hidden microphones and broadcast unsuspecting priests warning against the evils of birth control, homosexuality and surfing the Internet.
Two months ago, a disc jockey from an anti-government, church-owned radio station in Madrid posed as Zapatero and called Bolivia's socialist president-elect, Evo Morales, to congratulate him for joining the Cuban-Venezuelan leftist "axis." Morales fell for the gag, leading to red faces all around.
With exchanges like these, the battle between the church and Zapatero's government has spread from parliament to streets, pulpit and confessional, creating some of deepest political and social schisms in Spain since it returned to democracy 28 years ago.
"This is a government that is deeply secular and reform-oriented," said government spokesman Fernando Moraleda, arguing that Spain needed to adapt to its position as a modern member of the European Union. "We can't allow Catholic doctrine to be superior to the government and the government's legitimacy."
Church supporters say Zapatero's government is simply anti-clerical -- as socialists traditionally are in Spain -- and out of touch with Spanish society, which is more than 80 percent Catholic. They accuse the government of toying with a carefully crafted constitutional balance between church and state that has helped keep Spain peaceful and democratic since the death of the longtime dictator, Gen. Francisco Franco, in 1975. Clashes between the Spanish left and the church helped propel Franco to power during the 1936-39 civil war.
"The situation today comes from this government breaking with the consensus of the past. The peaceful, democratic transition" that followed Franco "has started to fracture," said Carlos Corral Salvador, a political and sociology professor at Madrid's Complutense University.
Government backers say the opposite -- that the church is out of step with Spanish society, as evidenced by surveys in which four out of five Spaniards call themselves Catholic but half of those say they are non-practicing. Conservative church leaders are refusing to modernize, government supporters say, and are struggling to retain their influence not only with the government but with moderate, younger priests and a flock that is demanding liberalization.
"It is an internal battle of the church, between bishops who were appointed by the Polish pope who are against modernization and who are very conservative, and other priests who are more modern and have less voice," said Alberto Moncada, president of Sociologists Without Borders, referring to John Paul, pontiff from 1978 until 2005.
Zapatero "is doing what the people want, what he was elected to do," Moncada said. "The church is watching its influence shrink in the minds of young Spanish people, and it wants to preserve its old privileges. This is about survival and power."
The Vatican views Spain as a special case because the church here was led by men who were strongly loyal to John Paul and exerted broad influence over social issues, said the Rev. Santiago Bueno, a professor of ecclesiastic law at Esade Business School in Barcelona.
"This is why the Vatican cannot understand same-sex marriages and adoptions, abortions and all those issues," Bueno said. "They are asking, 'How is it possible that Spain, such a Catholic country, is experiencing this?' At the same time, there is a fear that other countries of Hispanic and Catholic tradition, particularly in Latin and South America, could follow Spain's model. So I think the Holy See is playing very strongly in Spain, because it considers it a fortress of the faith."
Officials on both sides of the issue agree that the government is trying to change a relationship forged by Spain's 1978 constitution, which restored democracy to the country after four decades of Franco's rule. The new constitution abolished Catholicism as the official religion of Spain -- but granted it favored treatment, with generous state funding and other perks.
"The Spanish church should start a trend toward self-financing," said Moraleda, the government spokesman, noting that the state currently gives the church about $3.9 billion a year. "It's the best-treated church in Europe," he said.
In the meantime, about 400 same-sex marriages were performed in the first six months after such unions were legalized last April, Moraleda said. Because of extensive economic and social studies required for adoptions, no child has yet been awarded to a same-sex couple.
Those and other changes were needed, he said, because the Spanish people, in their lifestyles and attitudes, "had gotten ahead of their government." He added that "the hierarchy of the church has to adapt to the speed of society, not the other way around."
Many Spaniards say they are caught in the middle, eager to support the church but wanting to curtail its powers. Opinion polls show that about 80 percent of Spanish parents want their children to study religion in school, according to Alejandro Munoz Alonso, a professor of public opinion at Madrid's San Pablo University CEU and a senator from the opposition Popular Party.
Other polls show that two-thirds of Spaniards approve of the government's decision to legalize gay marriage.
As in the United States, the Catholic Church in Spain has suffered from declining attendance, fewer men joining the priesthood and sexual scandals. Spanish society has at the same time experienced a rise in HIV and AIDS, abortions, acceptance of homosexuality and other phenomena that strike at church teachings.
"The state has fallen behind its people and needs to reform and modernize itself, and it's time to get the church out of the schools," said Ana Carballeira, 40, a social worker visiting Madrid from Ferrol, a small port town 380 miles northwest of the capital. At the same time, she said, "the church -- its monuments, cathedrals and artworks -- are part of the Spanish patrimony and should continue to be funded by the state."
"The church is doing a good job in the schools, but they try to exert too much influence on the government, and they shouldn't," said Carlos Solans, 32, an economist with Telefonica, Spain's biggest telecommunications company.
"The church ought to be more tolerant, but the government ought to meet them halfway," particularly because so many of Spain's new immigrants are Muslim, said Jose Moya, 40, a flower vendor on Barcelona's famed La Rambla pedestrian boulevard.
Other people were less compromising. "The government is trying to modernize, but the church is against divorce, abortion -- everything!" snapped Maria Campo, 69, a tourist from Seville who was visiting the Barcelona Cathedral.
"The church is not against the government -- it's defending its values," said Ignacio Arsuaga, a 32-year-old Madrid attorney and founder of HazteOir.org (which means, roughly, Listen up!), a pro-church Web site that last summer helped to organize a demonstration in Madrid against gay marriage that drew 500,000 people, including 20 Catholic bishops.