MEXICO CITY — Mexico’s government is trying to delicately negotiate its way out of looming U.S. tariffs. But many fear that its talks with the Trump administration could break down, leading to a backlash here and long-term damage to the bilateral relationship.

Senior-level delegations from both countries met on Wednesday to try and reach a deal, and are scheduled to continue their talks on Thursday. 

“You always have to be optimistic, especially in a difficult negotiation with lots of tension,” said Mexican Foreign Minister Marcelo Ebrard, after the two-hour meeting. “We are going to find some point of agreement as soon as possible.” 

Mexican officials are eager to make a deal — worrying that the tariffs threatened by President Trump could further slow this country’s lethargic economy while also hurting U.S. businesses and consumers. At the same time, they also must contend with a Mexican public that is irritated by what it views as U.S. bullying. 

A poll published this week by the newspaper El Financiero gave a sense of the narrow path Mexican leaders are treading. An overwhelming number of respondents — 84 percent — said the nation should support President Andrés Manuel López Obrador’s diplomatic drive. But only 40 percent thought Mexico should cut off the flow of unauthorized migrants as Trump has demanded. 

“Regardless of how this story ends, Trump could scupper US-Mexico relations and lose #Mexico as a strategic partner and ally,” wrote Arturo Sarukhan, a former Mexican ambassador to the United States, in a tweet.

Trump has threatened to impose tariffs starting at 5 percent and gradually rising to 25 percent on all Mexican exports to the United States unless Mexican authorities prevent U.S.-bound Central Americans from crossing their country. López Obrador, a leftist who took office in December, has sought to maintain smooth relations with the U.S. president.

Trump said in a tweet on Wednesday that progress had been made in the talks — “but not nearly enough!”

 He said the talks would continue on Thursday “with the understanding that, if no agreement is reached, Tariffs at the 5% level will begin on Monday.”

Mexican officials have largely avoided discussion of retaliatory steps they could take. They could slap their own tariffs on U.S. products, potentially increasing pressure on Trump to cut a deal. The leader of a major Mexican agricultural association, Bosco de la Vega, said Wednesday that U.S. tariffs should be met with equal measures by Mexico.

“It’s right for Mexico to negotiate and be prudent, but when the aggression is so strong and unjustified, we will have to respond,” he told the newspaper El Universal.  

In the recent newspaper poll, 57 percent of respondents wanted Mexico to strike back with its own taxes on U.S. goods. 

Trump’s gambit has threatened to upend plans by the U.S. and Mexican congresses to ratify the updated version of the North American Free Trade Agreement. 

The tariffs could become the biggest bilateral crisis yet for U.S. and Mexican leaders. Mexico is heavily dependent on trade with the United States — the destination of 80 percent of its exports. 

“The bilateral relationship could be harmed for a long time” if an agreement is not reached soon, said Gustavo Mohar, a former top intelligence and migration official in Mexico. “President Trump is sending a very worrying signal about what Mexico faces while he’s in the White House.”

El Financiero’s poll found that only 16 percent of those surveyed expressed a favorable view of bilateral relations, compared with 33 percent in March.

The White House has not said exactly what it expects from Mexico. The Mexican delegation to the talks has not tipped its hand on what it may offer. 

But senior officials at the Department of Homeland Security have said they want Mexico to strengthen security on its border with Guatemala and intensify its investigation of smuggling rings that transport most migrants across Mexican territory.

Mohar said it would be a challenge to fortify Mexico’s 540-mile-long southern border, which passes through jungle and mountains and meanders along a river. 

Further complicating matters is Mexico’s lack of resources. The country’s police and military are fighting powerful organized-crime groups that have killed tens of thousands of people in recent years. 

Mexico “has a difficult strategic decision, because it would have to decrease security forces in other parts of the country that also require the presence of the authorities,” Mohar said.

Mexico has stepped up immigration enforcement dramatically in recent weeks — apprehending more than 22,000 unauthorized migrants in May, the highest monthly number in its history. But its poorly funded migration institute has been overwhelmed as families have poured out of Honduras, El Salvador and Guatemala in hopes of reaching the United States.