The devil was set to come to the historic city of Segovia, Spain, when some Catholic residents objected to those plans, signing a petition and beginning a legal challenge to run Satan out of town.
To be sure, officials had invited the devil, in the form of a five-foot bronze statue created by a local artist, José Antonio Abella.
Mr. Abella gave his statue the requisite two horns and made him explicitly nude. But this Satan statue is also relatively paunchy. He wears a benign smile and is portrayed taking a selfie with a bronze mobile phone.
The local council commissioned the statue, inspired by a local legend, last year to lure tourists to a less-popular part of Segovia’s Old Town, a Unesco heritage site. The city of 52,000 people north of Madrid is known for its 16th-century Gothic cathedral, a Moorish castle called Alcázar and 2,000-year-old Roman aqueduct.
The statue was to be placed on a wall above the Old Town, and the presentation appeared to be a marriage of modern culture and an ancient myth.
But the dispute is raising new questions about the coexistence of religion and artistic freedom in Spain.
A group of Catholics in Segovia were outraged by plans for the statue, saying that a friendly devil amounted to “glorifying evil” and would be deeply offensive to Catholics.
A petition to get rid of the statue gathered more than 5,000 signatures in three months. The San Miguel and San Frutos Association sought a court injunction to stop the installation.
“We found it repulsive, we think it’s obscene, and we don’t think that this statue is suitable to represent the city,” Maria Esther Lázaro, a founder of the association, said by phone on Friday.
The artist, for his part, said that he was surprised and hurt by the controversy.
“It was an enormous surprise to see some people, not even many of them, contest the statue,” Mr. Abella said in a phone interview.
“Segovia is a normal city with normal people,” he added, “and it hurts me to see the image of the place where I have lived for some 30 years damaged by this.”
To Mr. Abella, the statue has nothing to do with religion. It refers to a Segovia myth that the devil, not the Romans, had given the city its famous aqueduct, which towers 90 feet over the Old Town of Segovia.
According to the legend, the devil offered a deal to a young girl who was tired of dragging water through the city’s steep streets: He would get the water to her home before dawn, in return for her soul. As devil labored all night to build the aqueduct, she prayed. A storm came, holding up the devil’s work, and in the end, he lost his bid by one stone.
Ms. Lazaro said the statue was a departure from the true message of the legend: to “take care of one’s soul and repent.”
In recent years, Spain has seen similar high-profile court cases led by the Spanish Association of Christian Lawyers. The association has mostly used an article in the Spanish criminal code that forbids “offending the feelings of members of a religious confession.”
In 2014, the association tried to remove the director of the Reina Sofia art museum in Madrid for displaying artwork that alluded to burning churches. In 2017, it filed a complaint against a drag queen who performed as the Virgin Mary and Jesus on the cross. And the actor and theater producer Willy Toledo was briefly detained by the police last year after he ignored a court summons for publishing insults about God and the Virgin Mary online. He is still awaiting trial.
Other cases have targeted political art. Last year, a work labeling Catalonia’s separatist leaders as political prisoners was removed from an international art fair.
Segovia, popular with tourists, had largely avoided such controversy — until the devil appeared. Mr. Abella, a retired doctor who works as a novelist and occasional sculptor, had offered his statue to the city free. The idea for it came from a conversation with city officials in which Mr. Abella recalled the smiling devil he had seen years ago in the German city of Lübeck.
On Thursday, a judge rejected the injunction request against the statue and ordered the Christian association to pay 500 euros, or about $570, in legal fees, according to a court email on Friday.
Even if there is further opposition, the short, jovial devil is likely to take up residence in the city next week, Claudia De Santos, who leads the city’s heritage and tourism department, said by phone on Friday.
Ms. de Santos told El País that the Catholic association had claimed that Segovia would become a focal point for satanic worship.
“I just can’t believe that this could happen in 21st-century Spain,” she said.