MANILA (Reuters) - Philippine President Rodrigo Duterte voiced rare praise for the United States on Thursday, calling it an important security ally, and dismissing historic grievances and his slew of past tirades against Washington as “water under the bridge”.

Philippine President Rodrigo Duterte gestures as he delivers his speech, during the oath taking of Philippine National Police (PNP) star rank officers, at the Malacanang Presidential Palace in Manila, Philippines August 30, 2017. REUTERS/Romeo Ranoco

Duterte’s anti-American outbursts have become notorious and baffling for one of Washington’s closest Asian allies since the nation gained independence from the United States in 1946.

He was speaking on the 116th anniversary of one of the bloodiest battles in the American-Philippines war on the central island of Samar, where 39 Filipino civilians were killed in retaliation for the deaths of 48 soldiers killed by rebels.

Last year, at his first international summit in Laos, the maverick leader stunned regional leaders when he showed them pictures of that massacre.

Then U.S. President Barack Obama canceled a bilateral meeting there with Duterte, who had called him a “son of a bitch” days earlier for expressing concern about his bloody war on drugs.

On Thursday, Duterte said he had been advised to tone down his anti-American rhetoric and had positive words for the U.S. military, with which he has repeatedly threatened to sever ties, besides accusing it of supplying ineffective combat hardware and of making the Philippines a potential target for war.

“This is all water under the bridge, I was under advice by the Department of Foreign Affairs, that I would temper my language and avoid cursing, which I am prone to do if I get emotional,” Duterte said in a speech.

“I would not say they were our saviours, but they are our allies and they helped us. Even today, they provide crucial equipment to our soldiers in Marawi to fight the terrorists,” he said, referring to a city where Islamic State loyalists have been holed up for four months.

Duterte was speaking in Balangiga, a town burned down in 1901 by U.S. soldiers, who seized two church bells as war trophies. Duterte has demanded the return of the bells and the two countries are now discussing the terms.

Since Donald Trump replaced Obama as president, Duterte’s attacks on the United States have decreased, though he vowed never to go there and last week passed up the opportunity to attend the United Nations General Assembly in New York.

Duterte sprang a surprise last month with a warm reception for visiting U.S. Secretary of State Rex Tillerson, describing himself as a “humble friend” of the United States.

Some commentators have attributed his softer tone to the Trump administration refraining from criticism of Duterte’s signature war on drugs.

Duterte’s foreign minister Alan Peter Cayetano, who met Tillerson in Washington on Wednesday, said the Philippines was open to receiving foreign observers to examine its human rights record and war on drugs, which has killed thousands.

“We made it clear that we have nothing to hide and are ready to work with experts or observers as long as they are independent and fair,” Cayetano said in a statement.