Egypt's Coptic Pope Shenuda III, spiritual leader of the Middle East's largest Christian minority, died on Saturday at the age of 88 after a battle with illness, leaving the country's Copts in mourning.
He had suffered health problems for years and recently stopped receiving treatment for liver failure and tumours or swelling in his lungs because he was too feeble, the Coptic Church said.
The pope's health deteriorated Saturday after he suffered "a severe heart attack", sources at the church told the official MENA news agency.
"The last days were the hardest in the Pope's life, as he was unable to walk," said a church statement carried by MENA.
Shenuda was forced to cancel a weekly sermon last week over health concerns.
A funeral will be held on Tuesday at the papal headquarters for Shenuda, who was named pope of Alexandria in 1971.
There was no word on when clergy and laity would convene to begin the process of choosing a successor.
At St. Mark's Cathedral in the central Cairo neighbourhood of Abassiya, thousands crushed through a small opening at the cathedral's gate as bells tolled.
Worshippers had been told the pope's body had been laid out for the night inside and believed they would get a chance to look at the corpse and get blessings.
On the street outside, riot police stood guard at a distance.
"He was the father of every young man, women, widows and the orphaned. We have had many crises, and he gave us wisdom throughout all of them," said Emil Esam, 28 outside the pope's offices.
Shenuda led the Copts, estimated at 10 percent of Egypt's population of more than 80 million, for the best part of a generation, in which Egypt was hit by a wave of Islamic militancy from which he sought to protect his people.
Muslim leaders in the country almost immediately sent their condolences after news of his death broke.
Shenuda's death is "a grave calamity that has afflicted all Egypt and its noble people, Muslims and Christians," the country's mufti, Ali Gomaa, said in a statement.
The Muslim's Brotherhood Freedom and Justice Party, which controls parliament and the senate, sent condolences to the country's Copts and described Shenuda as having played a big role in Egypt.
Signup to our newsletter and follow us on Facebook and Twitter!
Shenuda was placed under house arrest by former president Anwar Sadat for his outspoken criticism of Sadat's courting of Islamists.
But he was supportive of Sadat's successor, Hosni Mubarak, who was overthrown by a popular uprising more than a year ago which led to an Islamist-dominated parliament -- the first in the country's history.
Shenuda, immediately recognisable by his long white beard, was believed to have viewed the widely despised Mubarak as a bulwark against Islamists, who believe non-Muslims should not be allowed to rule the country.
He was seen as a check on more radical Copts who urged more forceful reactions to sectarian attacks that have plagued their community, especially after Mubarak's ouster.
He was criticised by his own flock after he blamed "infiltrators" for triggering clashes between Coptic protesters and the army last year in which more than 20 people died, most of them Christians.
Many said they wanted him to take a harsher stand against the military, which has been accused of failing to carry out genuine reforms.
Copts celebrated New Year and Christmas amid tight security, after deadly attacks two years in a row following services.
Shenuda leaves behind a nervous community, a target of frequent sectarian attacks in recent years, who complain of routine harassment and systematic discrimination and marginalisation.
Egypt has also seen increased tensions between Muslims and Christians over the past few months, sparked by neighbourhood quarrels and disputes over church building and rumours of forced conversions.
Copts have been particularly concerned since Islamist parties, including ultra-conservative Salafi groups, won almost three-quarters of the seats in the first parliamentary elections since president Hosni Mubarak was ousted in a popular uprising.
Theologically, Shenuda was conservative, condemning a court decision calling on his church to allow divorce.
Shenuda's community is one of the Oriental Orthodox churches that are not in communion either with the Roman Catholic Church or the Eastern Orthodox churches because of a fifth-century disagreement over the nature of Jesus.
However, the pope maintained a keen interest in promoting church unity.
He served as head of both the World Council of Churches and the Middle East Council of Churches, and founded churches in several African countries.
Pope Benedict XVI, the head of the Roman Catholic Church had offered prayers for Shenuda, said a Vatican spokesman.