WARSAW, Poland (AP) - Cardinal Jozef Glemp, the longtime head of Poland's influential Roman Catholic church at a time when it played a key role in the fight against communism, has died. Jozef Kloch, a church spokesman, said in a statement that Glemp died Wednesday evening in Warsaw. Glemp had been ill for many years, and the Polish news agency PAP said he had lung cancer. Earlier in the day Warsaw Archbishop Kazimierz Nycz had asked the faithful to pray for Glemp, noting that his condition was deteriorating. Glemp oversaw the church at a critical time in its history and in that of Poland, a largely Catholic nation. He was the head of the Polish bishops' conference from 1981 to 2004. Until 2009 he also held the role of primate, the top leadership role. His years of leadership largely coincided with the papacy of the Polish-born Pope John Paul II, who was elected pope in 1979. In the following years, the church enjoyed huge influence in Poland thanks to John Paul's authority and his role in inspiring the Solidarity movement of Lech Walesa that helped topple communism in 1989. A key moment for Glemp as church leader came in 1981, when communist authorities imposed the harsh crackdown aimed at crushing Solidarity. Some democracy activists at the time faulted Glemp for failing to confront the regime forcefully, but said any seemingly conciliatory gestures were meant to try to prevent violence in the nation.