TORONTO — The Philippines on Thursday recalled its ambassador and consuls in Canada after Ottawa missed a deadline to take back tons of unwanted trash that have been rotting near Manila for nearly six years .

The move is the latest escalation in a long-simmering conflict that has weighed heavily on the relationship between the two countries and called into question Canada’s pro-environment reputation and its commitments to international treaties.

“At midnight last night, letters for the recall of our ambassador and consuls to Canada went out,” Philippine Foreign Secretary Teodoro Locsin Jr. said in a tweet. “They are expected here in a day or so.”

Until the trash is Canada-bound, he added, the Philippines will “maintain a diminished diplomatic presence” in the country.

The dispute began in 2013, when Chronic, a Canadian company, shipped more than 100 containers labeled as plastics to the Philippines for recycling. A spot inspection by customs officials found that only about one-third of them had recyclables. The rest were crammed to the brim with household waste, including old wires and soiled, leaking adult diapers.

The Philippines’ refusal to becoming a dumping ground for waste from overseas mirrors a trend across the region. Wealthier countries export huge amounts of plastic and other waste to places in Asia, but when China banned such practices in early 2018, it sent the industry into a tailspin.

Countries in Southeast Asia leaped to replace China’s role as a major importer of trash, according to a Greenpeace report, leading to unregulated dumping and burning. Since then, mountains of waste have piled up in countries such as Thailand, Indonesia and Malaysia, overwhelming local recycling facilities and landfills.

When Canadian Prime Minister Justin Trudeau visited Manila in 2015, shortly after he took office, he promised that a “Canadian solution” was in the works and that he would make legislative changes to ensure that such a thing did not happen again.

Canada tried to get the Philippines to dispose of the garbage without success. Then, in 2016, a Philippine court ordered Chronic to take the waste back, noting that the country was not a “trash bin.”

Pushed on the garbage issue on another visit to the Philippines, in 2017, Trudeau said the “legal barriers and restrictions” that had prevented Canada from taking back the trash earlier had been addressed, so it was “theoretically” possible for Canada to do something about it.

Instead, the garbage continued to languish at a private landfill near Manila, where it has been reeking ever since, much to the chagrin of environmentalists and public health activists, who have often staged protests outside the Canadian Embassy.

The protracted conflict ratcheted up — publicly, at least — in recent weeks thanks to Philippine President Rodrigo Duterte’s tough talk.

Last month, he threatened to “declare war” on Canada if it did not take back the trash.

“I want a boat prepared,” Duterte said at a news conference, before offering suggestions on what Canada might do with the garbage once it arrives.

“Prepare a grand reception,” he said. “Eat it if you want to.”

Defense Secretary Delfin Lorenzana later played down Duterte’s war threats, saying the president was using a “figure of speech” to express his displeasure.

Locsin, however, tweeted: “When the President speaks as he did to the extent of ‘declaring war on Canada’ for its garbage here, he is to be taken seriously and not metaphorically.”

In response, Canada said that it offered to repatriate the waste and would front the necessary shipping costs, but that there were still various details to work out.

Last week, Duterte spokesman Salvador Panelo said the Philippine government gave Canada a May 15 deadline to remove the waste. In a statement, he said that if the Canadians dragged their feet any longer, the Philippines would ship the containers and “throw them to the shores or beaches of Canada.”

But until the tweets Thursday morning, there were few indications that an escalation of this kind was in the cards. At a news conference Wednesday, Panelo said that while there could be a slight delay in Canada taking back its trash, “the important thing is, they are taking it,” according to Rappler, a Philippine news website.

In a tweet, Locsin said “the trigger” for the recalling of the diplomats was news from the Department of Finance that Canadian officials did not show up to a customs meeting.

Brittany Fletcher, a spokeswoman for Global Affairs Canada, said in a statement Thursday that the Trudeau government was “disappointed” by the Philippines’ decision but was “committed to finalizing” arrangements for the return of the waste.

Canada’s Environment and Climate Change Ministry said in a statement that the government was still resolving “outstanding details, including legal and regulatory issues.”

Experts say the dispute has blighted Canada’s reputation abroad, particularly because Trudeau has said that combating climate change and protecting the environment are near the top of his agenda.

Environmental groups in Canada and the Philippines say Canada is violating the Basel Convention, an international treaty aimed at reducing the transfer of hazardous waste between nations and preventing developed countries from dumping their trash in developing countries without consent.

Last month, the Pacific Center for International Law and Litigation in British Columbia said in a legal opinion that Canada had violated the convention because it inaccurately described the content of the containers and failed to take them back within 30 days of being notified of their contents.

In January, the EcoWaste coalition, a Philippines-based nonprofit, wrote a letter to Trudeau noting that South Korea also had illegally dumped waste in the Philippines but had taken some of it back within the same year.

“The stark contrast between South Korea’s actions and Canada’s indifference to its dumped waste has captured public attention and stoked anger at what is viewed as both disrespectful and illegal conduct by Canada,” the letter said.

Regine Cabato in Manila contributed to this report.