NEW YORK (CNN) -- Pope Benedict XVI concluded his six-day visit to the United States with a final address Sunday, thanking Americans for their hospitality and calling on people worldwide to pursue "justice and peaceful coexistence."
Before his departure, the pope encouraged "peaceful coexistence between people and nations."
"It has been a joy for me to witness the faith and devotion of the Catholic community here," the pontiff told a cheering crowd of more than 3,000 at New York's John F. Kennedy International Airport on Sunday night.
"It was heart-warming to spend time with leaders and representatives of other Christian community and other religions."
The pope was introduced by Vice President Dick Cheney, who said, "It's been a memorable week, and Pope Benedict XVI has stepped into the history of our country in a very special way."
"You've encountered a nation facing many challenges but with more blessings than any of us could number," Cheney told the pope, adding later, "You will always be welcome."
The pontiff told the crowd that his visit earlier in the day to Ground Zero -- the site of the September 11, 2001, terrorist attacks -- "will remain firmly etched in my memory, as I continue to pray for those who died and for all who suffer in consequence of the tragedy."
He said his visit to the General Assembly of the United Nations was one of the "high points" of his visit.
"I encourage people of goodwill everywhere to continue working tirelessly to promote justice and peaceful coexistence between people and nations," the pope said before his departure.
Benedict's three-day visit to New York was the second leg of his six-day trip to the United States -- his first since he was elected to the papacy. Watch a look back at his U.S. visit »
Addressing the audience at Yankee Stadium, Benedict called on his flock not to lose heart "in the face of resistance, adversity and scandal," and encouraged followers to reject "a false dichotomy between faith and political life."
"'Authority,' 'obedience' -- to be frank, these are not easy words to speak nowadays. Words like these represent a 'stumbling stone' for many of our contemporaries, especially in a society which rightly places a high value on personal freedom," he said in a homily delivered during his last Mass in the United States as millions across the world watched on television.
Vatican analysts have said one of the 81-year-old pope's goals for his trip was to help keep American Catholics in the flock, as many have left the church in recent years.
An influx of Latino Catholics has boosted the overall U.S. Catholic population. Parts of Sunday's service were in Spanish.
"We think of the successive waves of immigrants whose traditions have so enriched the Church in America," Benedict said in his homily. He noted that the Mass celebrated the bicentennial the creation of the Sees of New York; Boston, Massachusetts; Philadelphia, Pennsylvania; and Louisville, Kentucky. Watch a group of parishioners on a trek from Louisville to New York »
"In this land of religious liberty, Catholics found freedom not only to practice their faith, but also to participate fully in civic life," he said.
While he praised the U.S. Catholic Church for uniting "a widely diverse flock in the profession of the faith," Benedict -- a strict traditionalist -- also worked to guide American Catholics toward a more conservative view of doctrine. See photos from Sunday's service »
Polls show that about half of Americans who identify as Catholic support abortion rights. In a reference to that issue, the pope cited "the inalienable dignity and rights of each man, woman and child in our world -- including the most defenseless of all human beings, the unborn child in the mother's womb."
While he did not bring up the cases of abuse of young people by priests that have rocked the U.S. Catholic Church in recent years, the pope did mention "scandal."
"Praying fervently for the coming of the Kingdom also means being constantly alert for the signs of its presence, and working for its growth in every sector of society. It means facing the challenges of present and future with confidence in Christ's victory and a commitment to extending his reign. It means not losing heart in the face of resistance, adversity and scandal," he said.
The event drew worshippers from throughout the country who were lucky enough to get golden tickets. The crowd filed in early in the bright sunshine and cheered loudly and repeatedly as the pope entered in the "popemobile," before settling into a quiet, spiritual state for the service. Watch a report on one family's golden tickets »
Looking at the crowd filled with people of all ages, the pope had a message for those who could become the church's future leaders.
"Young men and women of America, I urge you: Open your hearts to the Lord's call to follow him in the priesthood and the religious life." See where the pope has visited »
Pope prays at Ground Zero
Earlier Sunday, the pope prayed at New York's Ground Zero, asking God to bring healing and strength to grieving families, and direction for people "consumed with hatred."
At Ground Zero, he greeted dignitaries, including New York Gov. David Paterson, New York Mayor Michael Bloomberg and New Jersey Gov. Jon Corzine.
"We ask you in your goodness to give eternal light and peace to all who died here," Benedict said.
The pontiff was joined by 24 people he invited to the ceremony, including family members of people killed in the World Trade Center attacks and rescue workers who survived the attacks. Watch the pope bless Ground Zero »
"We ask you, in your compassion, to bring healing to those who, because of their presence here that day, suffer from injuries and illness. Heal, too, the pain of still-grieving families and all who lost loved ones in this tragedy." he said.
The pope also prayed for "those who suffered death, injury and loss on the same day at the Pentagon and in Shanksville, Pennsylvania. Our hearts are one with theirs as our prayer embraces their pain and suffering."
He asked God to "bring your peace to our violent world -- peace in the hearts of all men and women and peace among the nations of the Earth."
He ended the prayer saying, "God of understanding, overwhelmed by the magnitude of this tragedy, we seek your light and guidance as we confront such terrible events.
"Grant that those whose lives were spared may live so that the lives lost here may not have been lost in vain."
New York Police Commissioner Raymond Kelly said before the event that "it means a lot to the first responders, and it means a lot to the city." E-mail to a friend