Cardinal Edward Egan, retired archbishop of the Archdiocese of New York, died Thursday at 82 and was remembered as a New York leader who gave moral support during the city’s most trying times.

Egan suffered a heart attack and was taken to NYU Langone Medical Center where he died around 2:20 p.m. His successor, Cardinal Timothy Dolan, made the announcement on his blog and later reflected on Egan's strong connection to the Big Apple at a news conference at St. Patrick’s Cathedral.

“He loved this city. He obviously loved the Catholic family of New York with a particularly paternal care. He loved its priests, its sisters, and parishes and especially the people,” Dolan said.

Egan served the New York Archdiocese — which oversees the Catholic parishes in Staten Island, Manhattan, the Bronx, Westchester and other parts of upstate New York — between 2000 and 2009.

Dolan said Egan was eating lunch with his secretary when he suffered his heart attack.

Egan received his final sacrament, the anointing of the sick, before he died, according to Dolan.

Dolan said there will be a wake at cathedral, but didn't have immediate details, and Egan's body will be entombed beneath the altar.

“It's sad to lose him but it leaves us grateful for who he was and thankful to God that he had a very happy death,” Dolan said.

Egan’s face was shown on the TV screens inside the cathedral while the organ played during the afternoon. St. Patrick’s visitors Thursday said they were surprised by the news of Egan’s passing.

“It does make coming here a little more meaningful," said Patricia Hoynes, 51, of Cheshire, Conn.

The city's elected officials past and present, reflected on his impact on all New Yorkers.

Mayor Bill de Blasio said he and first lady Chirlane McCray were saddened by the loss.

“He was a generous man who committed his life to serving others. His compassion was reflected in his deeds, and his ability to inspire those around him,” the mayor said in a statement.

Former Mayor Michael Bloomberg called Egan a “good friend” who “shard a lot of laughs.”

“He led his Church through difficult times, and he helped lead New York City out of our darkest hour. I could always count on his personal support, even when we held very different views,” he said in a statement.

Egan, an Oak Park, Illinois, native, was the Bishop of Bridgeport, Conn., for 12 years before he was installed in the New York Archdiocese. A year later, Pope John Paul II ordained him as a cardinal, the seventh in the city's history.

During his nine-year tenure, Egan led the church during some trying times including the 9/11 attacks. In an interview with the National Catholic Register during the 10th anniversary of the tragedy, he recounted how he tried to offer moral support to first responders.

“I had my pockets full of rosaries. We did what priests should do — we weren't policemen or firemen. We did what we could,” he said.

Egan also addressed the growing news of sex abuses in the church, offering his apologies to victims.

“If in hindsight we also discover that mistakes may have been made as regards prompt removal of priests and assistance to victims, I am deeply sorry,” he wrote in a letter in 2002.