MANILA — After weeks of trash talk, the diplomatic dispute between the Philippines and Canada over containers of household garbage is nearing an end with the promise by Ottawa late Wednesday to take the waste back by the end of June.

The dispute has cemented Philippine President Rodrigo Duterte’s domestic reputation as a hard-talking defender of his people.

But analysts say it is yet another example of the theatrics and posturing that have come to define his leadership. The incident also underscores how Duterte’s tough talk has been directed at the West, rather than at closer and more visceral threats such as China. 

Duterte’s response to the waste dispute “is typical of grandstanding performances to play to the galleries, without regard for external impact or potential backlash,” said Jay Batongbacal, a professor at the University of the Philippines who specializes in maritime law. 

The dispute centers on containers from Canada that began arriving in the Philippines in 2013 full of waste that was thought to be recyclable. The deliveries turned out to have been mislabeled and were instead thousands of tons of common household garbage, including diapers and other materials that could not be recycled.

The Canadian government said Wednesday that it had contracted a private company, Bolloré Logistics Canada, to bring the waste back “as soon as possible.” Minister of Environment and Climate Change Catherine McKenna said the company will begin preparing for the trash to be shipped in coming days, and the process will be completed by the end of June. 

“The costs associated with the preparation, transfer, shipment and disposal of the waste will be assumed by the government of Canada,” McKenna said, adding that her country values its “deep and long-standing relationship” with the Philippines. 

Canada has amended regulations to prevent such a thing from happening again and is looking to hold the responsible private companies to account, the minister said. 

The conclusion comes as relations between the two countries were set to hit their lowest point.

Just hours before Canada’s statement, the Philippines said it would take matters into its own hands. Duterte ordered his officials to find a private shipping company to deliver the more than 100 containers of trash back to Canada, said his spokesman Salvador Panelo. 

“If Canada will not accept their trash, we will leave the same within its territorial waters or 12 nautical miles out to sea from the baseline of any of their country’s shores,” he said.

Last week, the Philippines recalled its ambassador to Canada after the country missed a May 15 deadline to reclaim the garbage.

At one point, Duterte even threatened war over the issue, although officials in his administration differed over what he meant. Foreign Secretary Teodoro L. Locsin Jr. tweeted that the president’s remarks should be taken “seriously, not metaphorically” while Panelo said the president was just “teasing.”

Canada previously said it was “strongly committed” to receiving the shipment, but the years of delay prompted comparison with South Korea, which quickly took back more than 5,000 tons of garbage from the Philippines last year.

Although the dispute was initially a private matter involving the Canadian company, the Philippines’ escalation of the issue highlighted efforts by countries in the region to ensure that they do not become dumping grounds for waste from the West. Wealthier countries export millions of tons of plastic and other waste to Asia, but when China banned such practices in early 2018, it sent the industry into a tailspin. 

Deirdre McKay, who researches environmental politics and plastic waste, said “garbage diplomacy” has emerged as “public pressure for recycling programs in the global North has created a market for materials that are low value and not easy to recycle at all.” 

“Local governments have expanded curbside collection and found corrupt waste firms who will export the material labeled as something it is not,” she said. The Canadian household trash sent to the Philippines was labeled “high-quality plastic.”

When China instituted a ban on importing plastics, countries in Southeast Asia rushed to replace it. A Greenpeace report found that this led to unregulated dumping and burning in countries such as Indonesia, Malaysia and Thailand. Mountains of waste have piled up in these countries, overwhelming local recycling facilities and landfills. 

This is not the first time that Duterte has taken an unconventional and hard-line approach to his relationship with the West. In 2017, he demanded the return of historic church bells taken as war spoils in 1901 during the Philippine-American war. The United States returned them last year.

Although supporters praise Duterte for standing up to the West, his critics say he is playing down the most pressing threat to the Philippines: China, which has seized Philippine-claimed islands in the South China Sea in violation of international law. 

Duterte has said repeatedly that the country “cannot afford” a war with the eastern power over the maritime row.

“The presidential policy is to curry favor with China regardless of state of relations with others,” said Batongbacal, the maritime analyst .

Mahtani reported from Hong Kong and Rauhala from Washington.