Pope Benedict at a huge outdoor Mass on Sunday condemned drug trafficking and corruption in Mexico, urging people to put aside violence and revenge in the country where a murderous war between cartels has led to tens of thousands of deaths.

On his last day in Mexico, the pope said Mass for a vibrant crowd that organizers estimated at 300,000 people at a sprawling park on the outskirts of Leon in central Mexico, the biggest turnout for his Latin American trip.

The 84-year-old pope, wearing purple and white vestments, sprinkled the sermon he read from a massive white altar platform on a hillside with words such as conversion and reconciliation.

Many in the crowd covered their heads with hats, sheets and umbrellas against the blazing sunshine as Benedict prayed that Mexicans would be given the strength to boldly promote peace, harmony, justice and solidarity.

Later, speaking during his Sunday noon prayer, he said Mexicans should look to their faith at this time when so many families are separated or forced to emigrate, when so many are suffering due to poverty, corruption, domestic violence, drug trafficking, the crisis of values and increased crime.

Benedict also urged them to set aside futile acts of revenge and banish all hatred. Long lines of people, many praying, singing and carrying pictures of the leader of the world's 1.2 billion Roman Catholics and Our Lady of Guadalupe, Mexico's patron, flooded into the Mass site for hours.

Some camped out for more than a day to get a good spot at the event, the highlight of Benedict's three days in the world's second-most populous Roman Catholic country.

As the pontiff toured the crowd in a popemobile, he donned a black-and-white sombrero, to the delight of the crowd.

The pope is making only his second visit since his 2005 election to Latin America, which is home to about half of the world's Catholics. His predecessor, the late Pope John Paul, visited the region about once a year.

The archbishop of Leon, Jose Martin Rabago, set the tone for the day by spelling out the sufferings of a country where clashes between drug cartels and the state have claimed more than 50,000 lives over the past five years.

In the past few years we have been living through events of violence and death that have generated a painful sensation of fear, helplessness and grief, Rabago told the pope and the crowd in his welcome address.

The archbishop condemned what he called the perverse roots of Mexico's problems, listing them as poverty, lack of opportunity, impunity, injustice and the belief of some that life's aim was to accumulate possessions and power.

The overwhelming majority of our people, the archbishop told the pope, does not want to walk along the path of death and destruction. They yearn to live in peace...

Those words brought comfort to Santa Gurrola, a 38-year-old doctor from Zamora in neighbouring Michoacan state in western Mexico who spent the night in the park.

We are all praying so that our beloved Mexico stops being the place of so many murders, she said. In my state drug traffickers control everything. We need a blessing from the pope.

On his way to the venue, the pope flew by helicopter over the giant hilltop monument with the statue of Christ the King, a symbol of the often stormy religious heritage of Mexico, which was officially anti-clerical for years after a 1910 revolution.

We need the pope to motivate us with encouraging words so some good will come to us after everything that is happening, said Aaron Gonzalez, an engineering student from nearby Guanajuato. There is violence on our streets and in our families.

Benedict, who leaves for Cuba on Monday, addressed drug trafficking and the violence it causes in comments to reporters aboard the plane that brought him to Mexico from Rome on Friday.

He promised to unmask the evil of the spiralling drug war and the idolatry of money which enslaves man.

On Saturday night, the pope comforted a group of eight victims of the drug war. Alongside President Felipe Calderon, Benedict met relatives of a soldier and a policeman killed in combat with cartels, a man who survived a kidnapping, and the sister of a student shot by stray bullets during a street fight.

Calderon, from the conservative National Action Party, or PAN, which receives strong support from Catholics, has been criticized by the opposition for the timing of the pope's visit just 14 weeks before the next presidential election.

The president has staked his reputation on bringing the cartels to heel. But the government's inability to stem the gangland violence has eroded support PAN, which faces an uphill struggle to retain the presidency in elections in July.

Calderon cannot run for re-election and the PAN's candidate, Josefina Vazquez Mota, trails the presidential front-runner, Enrique Pena Nieto of the opposition Institutional Revolutionary Party (PRI), by double digits in most opinion polls.

(Additional reporting by Mica Rosenberg; Editing by David Brunnstrom and Bill Trott)