Philippines President Rodrigo Duterte has ordered tonnes of garbage to be shipped back to Canada. (File)

President Rodrigo Duterte has ordered tonnes of garbage dumped in the Philippines years ago to be shipped back to Canada, his spokesman said Wednesday, escalating a festering diplomatic row.

Duterte's spokesman warned also that if Ottawa would not formally accept the shipment of trash it would be dumped inside Canada's territorial waters.

The rubbish is stored in dozens of containers which a Canadian firm sent to the Philippines in 2013 and 2014 -- ostensibly for recycling -- and the issue of what to do with it has rankled for years.

Last week Manila recalled its ambassador from Ottawa because Canada missed a May 15 deadline to repatriate the garbage.

"As a result of this offending delay, the president has instructed the appropriate office to look for a private shipping company which will bring back Canada's trash to the latter's jurisdiction," Duterte spokesman Salvador Panelo told reporters.

"If Canada will not accept the trash, we will leave the same within the territorial waters or 12 nautical miles out to sea from the baseline of any of their country's shores."

Panelo said the order would be carried out "immediately".

The Canadian embassy in Manila referred requests for comment to officials in Ottawa, who were not immediately available.

Canada has agreed to take back the dozens of shipping containers, but has not given a timeline.

Diplomatic ties were already tested after Canadian Prime Minister Justin Trudeau, soon after taking office, questioned Duterte's deadly drug crackdown.

Duterte fiercely pushes back against any international criticism of his signature policy, which has seen police kill over 5,300 alleged addicts and pushers since 2016.

Last year the president cancelled the Philippine military's $235 million contract to buy 16 military helicopters from a Canada-based manufacturer after Ottawa put the deal under review because of Duterte's human rights record.

During a speech in April, Duterte threatened to unilaterally ship the garbage back to Canada, saying: "Let's fight Canada. I will declare war against them."

The president is notorious for foul-mouthed speeches that frequently include threats and hyperbole aimed at critics or perceived enemies.