Canadian Prime Minister Justin Trudeau said Wednesday that the United States, Canada and Mexico could be nearing a deal to rework the North American Free Trade Agreement, reflecting a surge of optimism that a pact may be within reach.

But, speaking at a news conference in Canada, he cautioned that more work must be done and warned that he will walk away from discussions if he thinks the deal doesn’t line up with Canadians’ best interests.

“We recognize that there is a possibility of getting there by Friday, but it is only a possibility, because it will hinge on whether there is ultimately a good deal for Canada,” Trudeau said. “No NAFTA deal is better than a bad NAFTA deal.”

President Trump told reporters at the White House that negotiations were going “really well.”

Trudeau and Trump are now jockeying publicly while frantically negotiating in private, as their top trade officials are engaged in continuous meetings in Washington.

Canadian Foreign Minister Chrystia Freeland expressed optimism Wednesday about the talks after a meeting with U.S. Trade Representative Robert E. Lighthizer. “I continue to be encouraged by the good conversations we are having and the progress we are making,” she said outside Lighthizer’s office.

Freeland arrived in Washington on Tuesday and met that evening with Mexican officials, who briefed her on the preliminary deal Trump announced Monday. The pact would establish new rules for manufacturing, labor and the environment.

“A lot has been accomplished,” she said, pointing out issues that the United States and Mexico have resolved. But, she added, “we have a huge amount of work to do this week.”

Freeland declined to discuss any unresolved issues. She said she and Lighthizer had agreed not to talk to reporters about specific disagreements as they negotiate, saying they preferred “not to negotiate in public.”

Canadian officials were largely excluded from discussions in recent weeks because of Trump’s ongoing feud with Trudeau, which on public view during the Group of Seven summit this summer in Canada.

On Monday, Trump announced that he had reached a trade agreement with Mexico and threatened to use that deal as a replacement for NAFTA, essentially threatening to remove Canada from the arrangement. It’s unclear whether such a move would be permissible under U.S. law, but Canada quickly rushed to the negotiating table.

A number of U.S. lawmakers came to Canada’s defense Tuesday, saying that they would not consider approving any changes unless Canada is involved.

Freeland said Canadian leaders are impressed by the progress the United States has made with Mexico, but she wouldn’t commit to fully supporting the broader changes.

Kelly Craft, the U.S. ambassador to Canada, who attended Wednesday’s meeting, told The Washington Post that discussions were very positive. “Everybody is moving forward, and that’s what’s important,” she said.

Canadian and U.S. negotiators have differences to resolve, including disagreements about dairy policy, the process for resolving trade disputes and intellectual property protection rules.

And Canadian officials have insisted that Trump remove tariffs he recently imposed on steel and aluminum imports before they finalize any deal.

Canadian negotiators are considering making two concessions on dairy protections in exchange for a few other key elements, the Globe and Mail reported Wednesday.

The concessions wouldn’t amount to dismantling Canada’s protectionist dairy system, but would instead reverse a more specific recent rule that cut off U.S. producers’ ability to export certain processed milk components to Canada at competitive prices.

For Canadian negotiators, sacrificing protections around ultrafiltered milk, an ingredient used in cheese, probably would bring less fallout than other potential concessions. The head of Saputo, one of Canada’s biggest cheese producers, said in June that he favored abandoning those protections if it meant saving NAFTA.

However, one representative for dairy farmers said Wednesday that no deal would be better than one with a concession for ultrafiltered milk. Graham Lloyd, the manager of Dairy Farmers of Ontario, said that after Canada implemented new trade rules last year regarding those products, dairy companies quickly upgraded their technology.

“Processors have invested hundreds of millions of dollars,” he said. “Abolishing [that rule], if that’s what’s being proposed, would cause irreparable harm to Canadian dairy.”

When asked about possible concessions, Trudeau said broadly that he would defend Canada’s dairy system. “It has been very obvious that the Americans want us to get rid of supply management, and that is not acceptable to us,” he said. “But the negotiations continue.”

Canadian business leaders suggested that it would be difficult to eliminate the dedicated NAFTA dispute resolution process. “We can’t have the U.S. Commerce Department deciding our trade disputes with the U.S. They’re the prosecutor, judge and jury in every case that they advance, and that’s just not acceptable,” said John Manley, president of the Business Council of Canada, an industry organization.

He said his group, which represents 160 of the country’s most powerful businesses, also is unhappy about the renegotiation clause in the U.S.-Mexico deal, even though it’s considered a climb-down for Washington.

“We’re looking for long-term investment,” Manley said in an interview. “We don’t want any sunset clause.”

Another major issue looming over the talks is Trump’s threat to impose 25 percent tariffs on all automotive imports from a range of countries, including Canada.

European Union negotiators were able to get Trump to postpone any decisions on the tariffs as part of their negotiations, but Canada could be looking for a more permanent exclusion .

Lighthizer wants to send a letter to Congress by Friday that would formally begin a 90-day process for reworking the trade deal. The precise terms of an agreement would not have to be completed until late September under such an arrangement.

Selena Ross and Alan Freeman in Ottawa contributed to this report.