UPDATE 3-Canada, Mexico vow to stick with NAFTA talks, Mexico works on Plan B

(Adds comments from Mexican president, details of talks in United States)

MEXICO CITY, Oct 12 (Reuters) - The leaders of Mexico and Canada on Thursday pledged to work toward a renegotiation of the North American Free Trade Agreement (NAFTA) even as talks taking place in the United States turned sour due to hard-line U.S. demands.

Speaking in Mexico City as a fourth round of talks to rehash NAFTA was held near Washington, Canadian Prime Minister Justin Trudeau and Mexican President Enrique Pena Nieto said they were committed to a “win-win-win” deal.

The talks in the United States hit obstacles, with tensions increasing dramatically Thursday due to U.S. demands that include adding a so-called “sunset clause” to NAFTA that would force negotiations of the $1 trillion pact every five years.

Two sources with direct knowledge of the talks in Arlington, Virginia described the atmosphere as “horrible” and highly charged.

“We will not be walking away from the table based on the proposals put forward,” Trudeau said at a news conference in response to a question about whether the clause was a poison pill for the talks.

Asked whether bilateral deals were possible if talks failed, Pena Nieto said Mexico would keep working with both Canada and the United States to reach a deal that was beneficial for all three countries, but he suggested there could be other ways to move forward.

“I think that Canada and Mexico share that the NAFTA agreement is a good mechanism, not the only one, but it is a good mechanism to boost the development of the region,” Pena Nieto said.

U.S. President Donald Trump says NAFTA, originally signed in 1994, has been a disaster for the United States and he has frequently threatened to scrap it unless major changes are made.

Besides the sunset clause, the United States also wants to modify dispute settlement mechanisms and boost the amount of U.S. content that autos must contain to qualify for tax-free status.

Business leaders from all three countries have said the U.S. proposals could derail the talks.

Earlier on Thursday Mexican Finance Minister Jose Antonio Meade said Mexico was analyzing tariffs and import substitution plans in case NAFTA was scrapped.

“We have the possibility of identifying tariff measures, we have the possibility to identify other markets to be our providers and other markets that we can turn to,” Meade told senators in the capital.

“We’re working on that, we have been working and perfecting the analysis to identify not only industries but companies that could help the contingency if we don’t reach a satisfactory negotiation.”

Meade did not give details of what tariffs were being analyzed. In 2011, Mexico successfully used targeted tariffs on U.S. goods such as pork and cheese to win a dispute over trucks.

Meade’s comments and the tensions at the talks drove the peso to a nearly five-month low of 18.92 against the dollar, a fall of more than 1 percent in the session. The currency has shed close to 4 percent since Oct. 3 on concerns the NAFTA talks could founder. (Additional reporting by Noe Torres,; writing by Michael O’Boyle; editing by Frank Jack Daniel, Jonathan Oatis and Michael Perry)