OTTAWA — A ketchup war is brewing, and Justin Trudeau is about to step into the middle of it.

Representing the United States is Heinz, which put 700 Canadian workers out of work in 2014 when it closed a plant in Canada’s tomato capital, a small southern Ontario town called Leamington. Anger and hand-wringing ensued.

Representing Canada is French’s, the mustard-maker, which began producing ketchup in Canada after the Heinz closure. In its bid for Canadian dollars, French’s even put a maple leaf on the bottle. Canadians rejoiced and bought French’s ketchup.

And on Sunday — which also happens to be Canada Day — Prime Minister Trudeau’s government is hitting back against the Trump administration’s tariffs on Canadian metals by slapping tariffs on $12.6 billion ($16.6 billion Canadian) worth of American-made products, including ketchup. To mark the occasion, Trudeau will spend part of the day not in the capital but in tomato country, meeting “Canadians and their families” and visiting a food processing plant.

The backlash to the Heinz closure began in earnest in 2016 on Facebook, when an Ontario construction worker called on Canadians to start buying French’s ketchup, which was then being made with tomato paste produced by an independent company in the old Heinz plant in Leamington. “Bye. Bye. Heinz” soon attracted tens of thousands of shares on Facebook and lots of media attention.

(French’s is in some ways no more Canadian than its rival. It’s now owned by McCormick & Co., the Baltimore-based spice and food company.)

Buoyed by the consumer demand, French’s hired a contract manufacturer last year to set up a full production line in Toronto for its product. The labels, adorned with a maple leaf, read: “Bottled in Canada with 100 percent Canadian Tomatoes.”

With widespread anger over President Trump’s imposition of tariffs on Canadian steel and aluminum and his comments about Trudeau after the G-7 summit, there have been growing calls for Canadians to buy local. Maclean’s magazine recently published “A Patriot’s Guide to Shopping During a Canada-U. S. Trade War,” with French’s ketchup topping the list of favored Canadian-made products.

“Demand is very robust,” said Andrew Mitchell, president of Select Food Products, which started French’s ketchup production with one weekday shift and has kept expanding. “We can’t keep up with demand, which is a good problem to have. We’re basically going 24/7. The made-in-Canada story is really resonating.”

Mitchell said that French’s has roughly doubled its market share in Canada for ketchup to 8 or 9 percent nationally, propelled by the made-in-Canada message, though Heinz still is the market leader.

“We only serve French’s since Heinz left town,” said Chad Robinson, who runs the Crave Family Grill restaurant in Leamington. “We try to buy as much locally as we can.”

Heinz will soon have more problems in the Canadian market. Ketchup, which is due to attract a 10 percent Canadian tariff as of Sunday, is one of scores of U.S. products to be hit by levies in addition to U.S.-made steel and aluminum. Canadian authorities are aiming at politically sensitive states and products, including gherkin pickles, lawn mowers and toilet paper from Wisconsin.

The Canadian government has been careful to impose tariffs on a limited number of food categories, for which Canadian-made substitutes can be easily found, said Sylvain Charlebois, dean of the Rowe School of Business at Dalhousie University and a specialist in the food processing industry.

Republican Sen. Patrick J. Toomey of Pennsylvania, where Kraft Heinz is based, told U.S. Commerce Secretary Wilbur Ross at a Senate hearing last week that he’s worried about the effect of the Canadian tariff on the company’s U.S. ketchup production in Fremont, Ohio.

“The solution for them to be able to continue to sell their product in Canada would be to shut down their U.S. factory and move it to Canada,” Toomey said. Ross didn’t respond.

Kraft Heinz won’t say what its production plans are but insists that it opposes all taxes and tariffs on its products.

“NAFTA has been in place for more than 20 years and we have developed supply chains that run across North America,” Michael Mullen, senior vice president of corporate and government affairs at Kraft Heinz, said in an email. “We are opposed to any change that impacts our ability to seamlessly move our products across these borders.”

As for the old Heinz plant, it was bought by Highbury Canco, which makes sauces, salsas and other products for several companies, including Heinz and French’s. Four years ago, it started out with 250 employees but expects to expand to 600 by fall.

Sam Diab, Highbury Canco’s president, said he’s thrilled that Trudeau will be at the plant Sunday and that there are plans for a big street party.

He refused to comment on the ketchup war (Heinz remains a customer), except to say this: “We don’t manufacture ketchup here.”