President Donald Trump’s drive to revamp the North American Free Trade Agreement has taken an unexpected turn — one that complicates his effort to replace that deal with one more favorable to American workers.

Canada, America’s longtime ally and No. 2 trading partner, was left out of a proposed deal Trump just reached with Mexico and is scrambling to keep its place in the regional free-trade bloc.

By contrast, Mexico has cut a preliminary deal with the United States to replace NAFTA with a pact that’s meant, among other things, to shift more manufacturing into the United States. In announcing the deal Monday, Trump said he wanted to call it the “United States-Mexico Trade Agreement.”

Canadian Foreign Affairs Minister Chrystia Freeland hurried to Washington on Tuesday to try to repair the damage. But she doesn’t have much time. What is next for Canada?

A 90-day countdown begins Friday

U.S. Trade Rep. Robert Lighthizer intends to formally notify Congress of the deal on Friday. This would begin a 90-day countdown that would allow Mexico’s outgoing president, Enrique Pena Nieto, to sign the new pact before leaving office Dec. 1. Otherwise, President-elect Andres Manuel Lopez Obrador might want to reopen the negotiations and further complicate the prospects for a new agreement.

To intensify the pressure on Canada, Trump proposed Monday to tax Canadian auto imports. As a result, said Philip Levy, a senior fellow at the Chicago Council on Global affairs and a White House trade adviser in the administration of President George W. Bush, Freeland is negotiating “under threat of auto tariffs or the demolition of NAFTA.”

The Trump administration says the deadline isn’t as tight as it seems. After notifying Congress of the new trade pact, it has 30 days to make public a copy of the full text.

“That means they have wriggle room” to fine-tune the details and squeeze Canada into a reimagined North American trade bloc, Levy said.

What is the U.S. objective?

U.S. Treasury Secretary Steven Mnuchin sounded an optimistic note Tuesday.

“Our objective is to get Canada on board quickly,” Mnuchin told CNBC. “I don’t anticipate there is going to be a lot of sticking points.”

Business groups and members of Congress have said they want Canada to remain in the regional trade agreement.

When the Trump administration notified Congress last year that it intended to renegotiate NAFTA, critics note that administration said it would begin talks with both Canada and Mexico. It’s unclear whether the Trump team has authority to reach a pact with just one of those countries. And Congress, which has to approve any NAFTA rewrite, might refuse to endorse a deal that excludes Canada.

“I don’t think we’ve seen something like this before,” said Stephen Orava, a trade lawyer who is a partner at the King & Spalding firm. “The path, both legally and politically, is a lot more complicated and has a lot more land mines.”

After taking effect in 1994, NAFTA removed most trade barriers among the United States, Canada and Mexico. Trade within the bloc soared. But many manufacturers moved plants south of the border to capitalize on low-wage Mexican labor and then shipped goods back to the United States.

During the presidential campaign, Trump railed about the manufacturing jobs lost to Mexico and about the U.S. trade deficit with its southern neighbor: $69 billion last year.

What does the new agreement change?

This week’s trade pact is meant to change the ground rules and return some manufacturing to the United States. Among other things, the U.S.-Mexico deal requires that 40 percent to 45 percent of cars be made in a country with auto wages of at least $16 an hour in order to qualify for duty-free status. Mexican auto workers now earn an average of just over $5 an hour, Americans nearly $22 an hour.

What are the flashpoints between the U.S. and Canada?

The two countries have battled over U.S. charges that Canada dumps subsidized lumber in the American market and uses big tariffs to protect its dairy farmers — topics likely to arise during Freeland’s visit.

Negotiations continue between Canada, U.S.

Canada seemed less willing than Mexico to accept the kind of NAFTA rewrite that Trump was requesting.

“Canada was happy with the status quo,” said Christopher Sands, director of Johns Hopkins University’s Center for Canadian Studies. Mexico, by contrast, “is keenly aware that NAFTA is their ticket out of developing country status … They wanted to do what it took to keep a deal. They were all about making a deal happen.”

The U.S. and Canada announced no breakthroughs Tuesday. But trade attorney Orava said: “There’s room for flexibility on all sides.”

But he conceded, “It’s going to be a very intense few days.”