SANTO DOMINGO, Dominican Republic (CNS) — Hugo Chavez, a socialist president who transformed Venezuela while acting as chief protagonist in what was one of the worst Catholic Church-government relationships in Latin America, died March 5. He was 58.

Chavez died of complications from a respiratory infection nearly two years and four surgeries after his cancer diagnosis was made public. He flew to Cuba for his fourth surgery in early December and developed post-surgical complications, including bleeding and a lung infection, doctors said.

Last April 5, Holy Thursday, shortly before his third surgery for cancer, Chavez attended a Catholic Mass in Barinas, the state in western Venezuela where he was born and where his brother, Adan Chavez Frias, is now governor. Wearing a rosary and dressed in a blue and white tracksuit, Chavez pleaded for his life.

"I ask God to give me life, however painful. I can carry 100 crosses, your crown of thorns, but don't take me yet. I still have things to do," he said, according to press reports.

Catholic leaders spoke of Chavez's relationship with the church and his legacy for Venezuelans.

"The people of Venezuela held him up, considered him a public leader that they felt a connection to; someone they were close with," said Auxiliary Bishop Jesus Gonzalez de Zarate of Caracas, secretary-general of the Venezuelan bishops' conference. There was "great hope for his recovery and that he would serve his third term."

Chavez, a former military lieutenant colonel, gained attention as leader of a failed coup in 1992. In 2000, he was elected president. He was due to be inaugurated for his third six-year term Jan. 10, but because of his illness he was never sworn in.

During his 13 years in office, he placed price caps on products sold by multinational companies and food basics. Chavez's critics, including many church leaders, said his programs were inefficient and indoctrinated poor Venezuelans in socialist philosophy.

Those programs won him political popularity among the poor, but with food basics, like milk and sugar, in short supply, the cost of some products rising with runaway inflation, and a high crime rate, his support within the poor neighborhoods waned.

The roughly 90,000 mostly poor, mostly Catholic Venezuelans that live in Carcacas' 23 de Enero neighborhood have mixed feelings about Chavez's legacy, said Franciscan Father Angel Antonio Tornero, pastor at Cristo Rey Parish.

"There have been many improvements to infrastructure and the community. The prices of food are lower. Chavez has support from many for the work that his government has done," Father Tornero said. "But there are contradictions. There are shortages of food, and many people feel like the government ignores their needs."

Father Tornero said the government has slashed funding to Catholic schools in the barrio, leaving them in a "financial crisis."

Church leaders said the church's relationship with the president was complicated, if not at times downright nasty.

"There were years that were difficult, tense," said Bishop Gonzalez de Zarate. "There were attacks and strong responses. ... But I feel that there was a calming in the past year."

He said that in the second half of 2012, the bishops' conference held two meetings with top Chavez government officials, including Vice President Nicolas Maduro, whom Chavez tapped as his successor.

In July, Chavez called the conference and suggested he was open to a face-to-face meeting, which would have been the first in at least six years, Bishop Gonzalez de Zarate said.

Chavez first won election promising a Cuban-influenced socialist "Bolivarian revolution." He used the nation's oil resources and a ballooning national debt to fund social programs that cut the South American country's poverty rate.

Initially, the relationship between Chavez and church leaders seemed warm. But it did not take long for things to sour.

Church leaders lent support to a short-lived coup that overthrew Chavez for 48 hours in 2002, saying he was abusing power and eroding democratic institutions. They kept up their criticism and, several years later, some Chavez supporters said that, with the hierarchy's almost obsessive opposition to the president, the bishops had distanced themselves from poor Venezuelans.

One community activist told Catholic News Service: "I agree there should be criticisms" of the government, "but constructive criticism that unites instead of separating."

The war of words continued, with successive Venezuelan Catholic leaders criticizing the president, who returned the criticism.

More recently, Chavez had suggested he was willing to mend relations with church leaders. In a July interview with Venezuelan state-owned television, he said, "hopefully we can manage to establish a good relationship with the Catholic hierarchy and to work together for the country.

"The church can contribute much along with the government in the fight against poverty, misery and crime," he said.

Bishop Gonzalez de Zarate said that Chavez had "opened the door" to improved relations.

"I'm not saying we have had fluid relations with the government, but there has been improvement," he said.

Born July 28, 1954, as the second of seven children of schoolteachers, Chavez was raised by his grandmother, a devout Catholic. He was an altar boy at his local church in a rural village in Barinas. As a child, he reportedly had always thought that he would become a priest.

As an adult, has described himself as a "Christian" whose policies are based on the teachings of Jesus Christ.

He used religion to win support from religious groups that helped elect him president in three consecutive elections.

"You have to take into account the evangelical card, which is his support base," Nikolas Kozloff, author of "Hugo Chavez: Oil, Politics and the Challenge to the U.S.," said in an email several months before the president's death. "Chavez has his own brand of Christian socialism, and he plays up the Christ martyr complex in his rhetoric."