DIRIAMBA, Nicaragua — A pro-government mob shoved, punched and scratched at Cardinal Leopoldo Brenes and other Catholic leaders as they tried to enter the Basilica San Sebastian. “Murderers!” people shouted. An auxiliary bishop was slashed on the arm with some sort of sharp object.

The ugly scene in the normally sleepy town of Diriamba, an hour’s drive south of Nicaragua’s capital, was a dramatic example of how rapidly a wave of unrest has soured relations between the Catholic Church and beleaguered President Daniel Ortega.

The Church has tried to play a mediating role between Ortega’s Sandinista government and protesters who have increasingly demanded his ouster amid demonstrations and clashes in which about 450 people — most of them protesters — have been slain.

Instead it finds itself increasingly targeted by Ortega and his backers, reviving a hostility between the Sandinista base and the Church establishment that burned hot during the 1980s but seemed to have been overcome in recent years, when the former guerrilla commander had formed a sort of alliance with once-critical bishops.

Brenes, the archbishop of Managua, went to Diriamba on July 9, a day after speaking to priests there by phone and hearing gunshots and ambulances. He found doctors and nurses who had tended to wounded protesters and now were sheltering inside the basilica, surrounded by pro-government forces.

“There was a fear that they would enter the church to snatch the people who were sheltering here,” said the parish priest, Father Cesar Alberto Castillo Rodriguez.

Despite the scuffle at the door, Brenes’s delegation, which included the Vatican’s top diplomat in Nicaragua, was eventually able to evacuate people from the church.

Two weeks later, despite a massive police presence, the church is covered with pro-government graffiti.

“My commander stays,” reads one scrawl, an allusion to Ortega, and others contain vulgar insults. They’re signed “JS” for the Spanish-language initials of the Sandinista Youth, a pro-government organization that has acted as shock troops against protesters.

The basilica eventually resumed services, but like many parishes in Nicaragua, it has stopped holding Mass in the evenings when police and armed pro-Ortega mobs rule the streets.

“We realized that the people weren’t coming,” Brenes said.

The Church, essentially the last independent institution trusted by a large portion of Nicaraguans, is witnessing the whiplash-inducing shifts of Ortega, who appears to have regained his footing amid the most serious challenge to his power in the decade-plus since he regained office.

In April the president asked the Church to mediate peace talks. But the dialogue quickly broke down when it became clear he would not move up elections scheduled for 2021.

Last week Ortega accused bishops of being in league with coup-plotters and allowing weapons to be stockpiled in churches — without offering any evidence — and said they were “disqualified” as mediators.

Days later he reversed course again, saying he hoped the Church would continue mediating and insisting that the government was not persecuting it.

“Ortega’s strategy with the Church has always been to either charm or to intimidate,” said Henri Gooren, an anthropologist at Oakland University in Michigan and editor of the Encyclopedia of Latin American Religions. “I think he found out that charming isn’t working … so all that he can do now is try to intimidate them, try to take away their credibility.”

Through his verbal attacks, Ortega is “telling his followers, especially the (pro-government gangs), ‘You can go ahead and beat up priests and bishops and vandalize church buildings without any punishment,'” Gooren said.

This week Brenes and his bishops met and agreed to continue pursuing dialogue, the only option he sees for stopping the violence. While discussion of “democratizing” Nicaragua has gone nowhere over Ortega’s refusal to leave office, he said negotiators have been able to secure help for arrested protesters, peaceful removal of some barricades and access by international monitors such as the OAS.

The way he sees it, without the dialogue even more would have been killed.

The 69-year-old cardinal can also take a long view, because he’s been through this before.

Interviewed on the patio of his modest home in Managua, Brenes recalled how decades ago as a young priest, he harbored youths who supported Ortega’s Sandinista Front when they were pursued by national guard troops from the Somoza dictatorship.

And in 1979, after transferring to a parish in Jinotepe, armed Sandinista fighters took over his church. Once a sniper trapped him in the rectory with a woman and a young girl he had pulled inside. They hid under a washbasin for three days surviving on cookies and a bag of pinol, a cornstarch and chocolate powder mixed with water or milk.

In 1991, Brenes helped mediate between the Sandinista army and U.S.-backed Contra rebels, traveling into the mountains of Matagalpa and running back and forth between representatives of two sides that refused to even approach each other.

After Ortega’s speech calling the bishops coup plotters, Brenes said that he looked up the Spanish word, “golpista,” in the dictionary, and what he found was the antithesis of what he’s trying to do.

“I read there: ‘Someone who acts to take power,'” Brenes said. “Well, that’s not me. That’s not us.”

Ortega clashed repeatedly with the Church’s conservative authorities when his socialist-oriented Sandinistas governed in the 1980s — a time when many young leftist priests openly backed the former guerrillas, infuriating Pope John Paul II.

But Ortega worked to mend relations with the Church after he lost elections in the 1990s, and by the time he regained power in 2006, he was making frequent public displays of piety and had forged a friendship with the Nicaraguan Church’s leader, the late Archbishop Miguel Obando y Bravo.

When the new wave of protests broke out in April — initially over cuts to the social security system — government forces and Sandinista Youth struck back hard.

On April 20, hundreds of student protesters sought refuge at Managua’s cathedral, where the church was collecting donations to support demonstrators. When police and Sandinista Youth descended, the students retreated inside, leaving only after clergy negotiated their safe passage.

Brenes and several bishops made public statements against violence and in favor of dialogue. The Episcopal Conference later issued a more forceful condemnation of the crackdown and urged authorities “to hear the cry of the young Nicaraguans.”

The Vatican has been mostly quiet about the conflict, deferring as it usually does to behind-the-scenes diplomacy while the local Church manages the situation on the ground.

Last week Pope Francis’s ambassador to Nicaragua did put out a statement expressing the pontiff’s “deep concern for the grave situation.”

The same day as the attack in Diriamba, Ortega supporters sacked the Santiago Apostol parish in Jinotepe, tossing pews down the front steps while shouting that the church was harboring terrorists.

The most harrowing incident occurred at the Jesus of Divine Mercy church in Managua.

For nearly 15 hours overnight on July 13-14, armed government backers fired on the church while 155 student protesters who had been dislodged from a nearby university lay under the pews. A student who was shot in the head at a barricade outside died on the rectory floor.

Brenes made sure they arrived safely at the city’s cathedral.

The Divine Mercy’s facade is still pocked from hundreds of bullet impacts. A small chapel behind the main sanctuary sustained the heaviest fire; rounds pierced a painting of Jesus Christ and ricocheted off the gold-plated box holding the sacrament.

On a recent Sunday, parishioner Nelly Harding, 56, wiped away tears as she stepped outside the chapel: “If they don’t respect the house of God, don’t respect the lives of defenseless people, what can we hope for?”

Parish priest Father Erick Alvarado Cole said police have not come to investigate, and the building’s scars will be left just as they are.

“These holes in the walls, the Christ, the side chapel, the windows, are going to stay this way as proof of the pain of the Nicaraguan people,” Alvarado said. “If it’s repaired, it’s like nothing happened.”

Associated Press writer Nicole Winfield contributed to this report from Rome.