In the last days of a fevered presidential campaign, tens of thousands of Mexicans poured into soccer stadiums and plazas across the country, listening to stump speeches from four candidates one last time, while rock bands performed.

It is a crucial moment for Mexico — facing its most significant security crisis in recent history, an escalating trade war with the United States and a loss of faith in mainstream politicians.

On Tuesday and Wednesday, the official closing of the campaign, the top three candidates took turns addressing those concerns, even as the race appeared increasingly lopsided, with Andrés Manuel López Obrador as the heavy favorite.

“We are going to win the presidency. The polls and everything else show us above,” said López Obrador, a leftist who leads in some surveys by more than 20 points.

“We will emerge victorious and more united in front of those who want to divide us,” said José Antonio Meade, the candidate of the governing Institutional Revolutionary Party (PRI), which has lost support because of scandals.

“This campaign is going to win thanks to strength and determination,” said Ricardo Anaya, a 39-year-old political wunderkind representing a coalition including the conservative National Action Party (PAN), who has struggled to gain traction with the country’s working class.

Those generic valedictions belie a race for president unlike any in this country’s history. Mexico was ruled by one party from 1929 to 2000, and its presidents since then have come from one of two mainstream parties, the PRI and the PAN. This year, a man from outside the country’s conventional political orbit is not only in close contention — he’s leading by a wide margin.

In addition to choosing a new president, Mexicans will also elect a new Congress, nine governors and hundreds of mayors and local representatives. The campaign has been stained by violence, with 130 politicians and campaign workers killed, a reflection of the threat of powerful drug-trafficking and organized-crime groups.

At López Obrador’s rally on Wednesday at the huge Azteca soccer stadium in the capital, his supporters spoke about the massive change they expect after the election. Mexicans will go to the polls on Sunday.

“Even we didn’t expect to be winning by a margin this big,” said Marcelo Ebrard, the former mayor of Mexico City and an adviser to López Obrador.

Three hours before López Obrador was scheduled to arrive, tens of thousands of his supporters were pouring through a single stadium gate.

Many had been carried here by buses from across the capital and from nearby states. Others walked miles from their neighborhoods or flowed out of a nearby metro stop.

A carnival atmosphere pulsed, with music blasting from car speakers and fans chanting political slogans or the name of López Obrador — often abbreviated to his initials, AMLO. Vendors sold small AMLO dolls or flags emblazoned with his likeness. López Obrador’s Morena party is part of a coalition that includes small leftist and religious parties.

“My town always voted completely for the PRI, but the AMLO tsunami has carried everything with it,” said lawyer Antonio Sanchez, who came with neighbors by bus from Aculco, about 40 miles outside Mexico City.

“We lack jobs, clinics, security,” he said. “You see all the tricks and frauds and just get tired. We have to see a change.”

He said that even in rural towns like his, people devour news on social media, which has allowed for a more diverse range of information than is sometimes featured on TV networks seen as close to the government.

“It’s opened people’s eyes and caused a more conscious vote,” he said.

Erica Ortiz, a 40-year-old housewife, and a dozen of her neighbors hiked miles to the stadium from their working-class neighborhood in Mexico City.

This was her third time voting for López Obrador, who ran unsuccessfully for president in 2006 and 2012. Despite López Obrador’s wide lead in the polls, she said, she was afraid that the election could be marred by fraud.

“If they steal it, this city, the country, will explode,” Ortiz said, panting from her fast-paced walk. “They have been warned.”

In Mexico, the “cierre de campaña” or “close of the campaign” marks the end of the candidates’ race for the presidency. It is as much an opportunity for politicians to address their supporters as it is a chance to broadcast their popularity.

The current president, Enrique Peña Nieto, is limited to one term.

While the polls showed López Obrador with a commanding lead, they also showed Mexicans’ lack of faith in the electoral process. In one poll from Reforma, a major newspaper, 53 percent of respondents said they lacked faith in the country’s electoral commission.

López Obrador had spoken earlier on Wednesday to a crowd in the southern state of Chiapas, alluding to his roots in Mexico’s south, the poorest region in the country, with a tradition of strong leftist leaders dating back to Mexico’s revolution. He noted the example of a state governor a century ago who revived the state by balancing its budget and building public works.

“Se va a tabasqueñizar a México,” he said. “We are going to make the rest of Mexico like Tabasco.”