The Gospel calls Christians to bring the elderly to the center of their lives and away from the margins of families, politics and financial markets that banish them as "unprofitable waste" in society, Pope Francis said.

"Let it not happen that by pursuing the myths of efficiency and performance at full speed we become unable to slow down to accompany those who struggle to keep up," he said in his homily at a Mass for World Day for Grandparents and the Elderly in St. Peter's Basilica July 23.

"Please, let us mingle and grow together," he said.

Elderly persons in wheelchairs were seated in the front row before the altar and alongside Pope Francis. Several grandparents with young children in tow were scattered among the estimated 6,000 people in attendance in the basilica.

"We need a new alliance between young people and the elderly," Pope Francis told them in his homily, "so that the sap of those who have a long experience of life behind them will nourish the shoots of hope of those who are growing."

"In this fruitful exchange we can learn the beauty of life, build a fraternal society and in the church we can allow for encounter and dialogue between tradition and the newness of the Spirit," he said.

Cardinal Kevin J. Farrell, prefect of the Dicastery for the Laity, Family and Life -- which organizes the world day -- was the main celebrant at the altar. The theme for this year's celebration was "His mercy is from age to age," taken from St. Luke's Gospel.

In his homily, the pope related the elderly's role in society to the three parables Jesus tells in the day's Gospel reading from St. Matthew.

In the first parable, the devil plants weeds among a wheat crop while the householder is asleep, but rather than tell his slaves to pull them up he allows them to grow until harvest for fear of uprooting the wheat with it.

"The good and the bad are intertwined to the point of appearing inseparable," Pope Francis said. But, "Christians, enlivened by hope in God, are not pessimists, but neither are they naive people who live in a fairy-tale world, who pretend not to see evil and say 'all is well.'"

"No, Christians are realists: they know there is wheat and weeds in the world," he said.

The pope noted the common temptation to create a "pure" society and church that risks making people "impatient, intransigent, even violent toward those who have fallen into error."

"In that way, together with the weeds we pull up the good wheat and block people from moving forward, from growing and changing," he said. Instead, by "beating the temptation to divide the wheat from the weeds, we are called to understand the best ways and moments to act."

The elderly, who have "already come a long way in life," he said, are examples of embracing life's beauty as well as its challenges.

"Old age is a blessed time also for this reason: it is the season to be reconciled, to look with tenderness at the light that has advanced despite the shadows, in the faithful hope that the good wheat sowed by God will prevail over the weeds with which the devil has wished to infest our hearts," said the pope.

He also recalled the parable of the tiny mustard seed that grows into a large bush where birds make nests among its branches.

"At the beginning we are a small seed, then we are nourished by hopes, we fulfill projects and dreams, the most beautiful of which is becoming like that tree, which doesn't live for itself but makes shade for who wants it and offers space for who wants to build a nest," said Pope Francis.

He said that grandparents and grandchildren "grow together" like the tree and the birds that settle in its branches, where they "learn the warmth of home and experience the tenderness of an embrace."

Urging the elderly and young people to engage with one another, the pope turned to the parable of the yeast in which a whole batch of bread is leavened by a small measure of yeast. He encouraged the young and elderly to "mix with one another" and to "come out from yourself to join with others."

Such intergenerational interaction, he said, "defeats individualism and selfishness, and helps us generate a more humane and fraternal world."

After Mass, five elderly people in St. Peter's Basilica symbolically handed over a pilgrim's cross to five young people traveling to World Youth Day in Lisbon, Portugal, which is scheduled for Aug. 1-6. The gesture represents the elderly's commitment to "pray for the departing youth and accompany them with their blessing," the Dicastery for the Laity, Family and Life said in a statement.

Shortly after, Pope Francis appeared at the window of the papal studio overlooking St. Peter's Square with a young person who was going to attend World Youth Day and his grandmother on either side of him. The pope noted the significance of a day dedicated to celebrating the elderly right before World Youth Day begins.

"May the closeness of these two days be an invitation to promote an new alliance between generations of which there is so much need; so that the future may be constructed together, in the sharing of experiences and reciprocal care between young people and the elderly," he said after praying the Angelus.

Noting the strong heat waves in many countries and recent flooding in South Korea, Pope Francis called on governments to act concretely to reduce polluting emissions, and he asked the estimated 20,000 people in St. Peter's Square not to forget the ongoing migration crisis in northern Africa.