MEXICO CITY — Mexico is coming off its deadliest year in recent history. Record amounts of opioids and cocaine are being seized en route to the United States. Mexico’s army patrols cities in wide swaths of the country, its navy busts down doors on raids against drug cartel bosses.

Andrés Manuel López Obrador, the front-runner in the lead-up to Sunday’s presidential election, is touting a gentler approach.

“Abrazos, no balazos” — or “hugs, not gunfire” — has been a campaign slogan.

The leftist politician is pledging to alleviate poverty as a way to solve the crisis of violence here, while maintaining a partnership with the United States. “You can’t fight fire with fire,” López Obrador has repeated.

The next president’s approach will probably have far-reaching consequences on both sides of the border. It could impact how much heroin and other opiates circulate in American cities, how many Mexicans cross into the United States fleeing violence, and how much illicit narco-cash floods Mexican society, corrupting police and politicians.

Violence has reached record levels in Mexico, with nearly 30,000 homicides last year, the highest in two decades of available statistics. Traditional drug cartels have splintered into increasingly violent rival factions that extort, kidnap, steal gas and rob trains, in addition to selling drugs. During the campaigns for Sunday’s elections, which include contests for governorships, congressional seats and local offices, some 130 politicians and campaign workers have been killed.

“Insecurity is the number one problem in the country,” said Marcos Fastlicht, a prominent businessman and one of six security advisers on López Obrador’s team.

But López Obrador’s vague proposals have left security experts confused about whether he represents a fundamental departure from how previous Mexican presidents have dealt with drugs and violence, and whether he might weaken the security partnership with the United States. Over the past two Mexican administrations, U.S. agencies such as the Drug Enforcement Administration and FBI have worked especially closely with their Mexican counterparts in the hunt for drug traffickers, providing intelligence and equipment, and partnering on missions.

López Obrador is a longtime leftist politician who has steadily moved to the center in recent years. Before the last election, in 2012, he called for blocking U.S. intelligence work in Mexico. In this campaign, however, he has called for a robust relationship with the United States on trade and security.

“I believe that there will be continuity in the security cooperation” with the U.S. government, said Jorge Chabat, a security analyst and professor at the University of Guadalajara. “I have no doubt that he will have a period of rethinking security cooperation, but I don’t believe that there will be real changes.”

Others say profound change is possible.

“The bottom line is he’s not going to fight the drug war in the way that it’s been fought in the last few decades,” said David Shirk, a professor at the University of San Diego who is an expert on security issues in Mexico. “That is potentially a huge change.”

Considering legalization

López Obrador and his team of security advisers have pointed to extreme poverty as the ultimate source of Mexico’s insecurity and say they will offer jobs and scholarships to woo vulnerable Mexican youth away from cartels. The candidate has also floated the idea of an amnesty for those involved in the drug business — a plan that sparked instant controversy and that was followed by assurances from his aides that it would be limited to farmers growing drug crops.

López Obrador has also opened the door to legalizing drugs — Mexico has already decriminalized personal possession of small amounts of marijuana — and does not appear interested in ratcheting up confrontations with the cartels. He has called for taking the military out of police-type work against drug gangs.

However, López Obrador is not rushing to withdraw the military from cities; his goal is to do it over three years, according to one of his security advisers. And he has proposed a new 300,000-man National Guard comprising military and police that would do essentially the same work, but, the campaign hopes, with better coordination between security agencies.

At a campaign stop in Culiacan, the capital of Sinaloa state, one of the country’s centers of drug production and trafficking, López Obrador said, “We’re not only going to use force,” the New Yorker magazine reported. “We’ll analyze everything and explore all the avenues that will let us achieve peace. I don’t rule out anything, not even legalization — nothing.”

López Obrador’s opponents have seized on his amnesty idea to paint him as eager to set free criminals. “You want to forgive the unforgivable,” José Antonio Meade, the candidate of the governing Institutional Revolutionary Party, said during a debate about security issues.

López Obrador first raised the idea of amnesty in December in the western state of Guerrero, Mexico’s heroin-producing heartland.

After an uproar, López Obrador and his advisers insisted that he won’t be setting violent criminals free but would rather prevent the prosecution of poor farmers who plant marijuana and opium poppy.

“Kidnappers? No,” said Olga Sánchez Cordero, a former Supreme Court justice who has been chosen to lead the powerful Interior Ministry if López Obrador is elected, about possible amnesty recipients. “Who? The people working in rural areas, who are criminals because they work in the illegal drug business, but haven’t committed crimes such as murder or kidnapping.”

Security experts say many details would still need to be clarified and legislated. Some see the idea as a continuation of sweeping judicial overhaul put in place over the past decade in Mexico, which sought to decriminalize minor drug offenses and solve more cases through mediation and restitution.

Others see little value in an amnesty as a way to reduce violence.

“It’s a question of justice, not a question of security,” said Francisco Rivas, director of the National Citizen Observatory, a security watchdog. “If a person was forced to commit crimes, then we need to reopen these cases. [But] what we can’t say is: Reopening these cases or giving amnesty to criminals is going to reduce violence.”

López Obrador has proposed some changes that have echoes of other administrations. His National Guard plan has similarities to President Enrique Peña Nieto’s program to create a new Gendarmerie, a force that has been widely criticized as ineffectual and unable to settle on a mission.

“I’m not overwhelmed by any of it,” Eric L. Olson, an expert on Mexico and security at the Wilson Center in Washington, said of López Obrador’s security plans. “It falls well within the norm for what other politicians have been saying.”

López Obrador’s security advisers insist that they want to preserve a good working relationship with U.S. security agencies, including the DEA. The DEA and other agencies often provide the intelligence that leads to the arrest of high-level drug traffickers. Analysts say that cutting that off would harm Mexico more than the United States, and Mexico wants help on issues such as stopping the flow of weapons into the country.

“We are going to ask for the cooperation of the United States” on blocking the trafficking of guns, said Alfonso Durazo, one of López Obrador’s security advisers — a regular refrain from Mexican politicians.

The security relationship goes both ways: U.S. agencies assist their Mexican counterparts on narcotics, while Mexican agencies help the American government by detaining U.S.-bound migrants from Central America. If relations between a López Obrador government and the Trump administration became strained, Mexico’s cooperation could decline.

“López Obrador could easily order the security forces not to take any action against immigrants coming from Central America and transiting Mexico,” said Mike Vigil, a former DEA chief of international operations. “And if they do that, the 2,000-mile border will be a leaky sieve.”

President Trump has regularly criticized Mexico over drugs, crime and migration. López Obrador, a more combative personality than Peña Nieto, could have less patience with the U.S. leader.

“If Trump’s feeling vulnerable or he needs to bash Mexico, that’s where the clash becomes almost inevitable,” Shirk said. “That could all play out very, very poorly over the next few years.”

Gabriela Martinez contributed to this report.