An estimated one million people gathered at Madagascar's Soamandrakizay stadium in the capital on Sunday to hear Pope Francis say mass on the second leg of his three-nation African tour.
The massive crowd had waited patiently, stretching into the distance from the early hours, to see the pope, the first pontiff to visit in 30 years.
"Organisers estimate there are around one million people," a Vatican spokesman said.
Organisers had said earlier they expected around one million attendees. Some described it as the biggest public gathering in Madagascar's history.
Many people wore pope-emblazoned white and yellow caps -- the colours of the Vatican, and they cheered as the pope-mobile made its way through wind-swept clouds of red dust picked up from the stadium floor.
During the homily, the Argentine pontiff urged them "to build history in fraternity and solidarity" and "in complete respect for the earth and its gifts, as opposed to any form of exploitation".
He spoke out against "practices that lead to the culture of privilege and exclusion" and criticised those who consider family "the decisive criterion for what we consider right and good".
"How hard it is to follow him (Jesus) if we seek to identify the kingdom of heaven with our personal agenda or... abuse the name of God or of religion to justify acts of violence, segregation and even murder".
After mass the pontiff will visit Akamasoa, a city founded by Argentian priest Father Pedro, who has lifted thousands of Malagasy waste-pickers out of poverty.
Early Sunday morning, in Antananarivo's Andravoahangy church, pastor Jean-Yves Ravoajanahary had briefed 5,000 people on the two-hour trek they would have to make to get to Soamandrakizay stadium.
"We are going to divide worshippers into groups of 1,000 because the road is very dangerous. At this time pickpockets and bandits are out to mug people," he told AFP.
One by one the groups started the journey, huddled together in the cold and singing praise to the Virgin Mary. Traffic was gridlocked.
Hery Saholimanana left his house in the early hours with three family members.
"I'm afraid of arriving after the 6:00 o'clock entry limit," said the 23-year old IT student, walking briskly.
Rado Niaina, 29, told AFP he left even earlier, at 2:00 am, for fear "of not finding space".
Many had already set up tents on the outskirts of the city on Friday, festooned with posters of the pontiff.
Prospere Ralitason, a 70-year-old farm worker, arrived with some 5,000 fellow pilgrims from the central eastern town of Ambatondrazaka, 200 kilometres (125 miles) away.
"We are tired, but it's worth making all these sacrifices to see the pope with our own eyes and receive his blessing," he said.
'Hope for change'
Thousands of young people -- mainly scouts -- gathered for a vigil at Soamandrakizay on Saturday, waiting hours in the heat for Francis to arrive.
"I am here to ask for the pope's blessing to face the harsh realities of life, insecurity, poverty and corruption," said 17-year old student Njara Raherimana.
"All this gives me hope for change in my country," echoed fellow student, Antony Christian Tovonalintsoa, who lives on the outskirts of the capital.
During the vigil, Pope Francis lauded the "joy and enthusiasm" of the singing crowd.
He encouraged the youth not to fall into "bitterness" or to lose hope, even when they lacked the "necessary minimum" to get by and when "educational opportunities were insufficient".
Earlier on Saturday, Francis made an impassioned plea to Madagascans to protect the Indian Ocean's unique environment from "excessive deforestation".
Weeks after a spike in fires in the Amazon, the Argentine pontiff told his hosts they should "create jobs and money-making activities which respect the environment and help people escape poverty".
Madagascar -- famed for its immense diversity of flora and fauna -- is home to 25 million people, the vast majority of whom live in poverty on an income of less than two dollars a day.
More than half of its young people are out of work, even if many have good qualifications.
The last pope to visit Madagascar was John Paul II 30 years ago.
Francis also visited Mozambique earlier in the week, and is due to travel to the island of Mauritius on Monday.