BEIJING (Reuters) - Malaysian premier Najib Razak said that former colonial powers should not lecture nations they once exploited on their internal affairs, a Chinese newspaper reported on Wednesday, in a veiled attack on the West as he looks to strengthen ties with China.

Malaysia's Prime Minister Najib Razak inspects honour guards during a welcoming ceremony at the Great Hall of the People, in Beijing, China, November 1, 2016. REUTERS/Jason Lee

Najib’s visit to Beijing follows that of Philippine President Rodrigo Duterte, who announced a “separation” from the United States and signed a raft of memoranda of understanding for Chinese investment in the country.

Najib, who is on a six-day visit to China, said in an editorial in the state-run China Daily that larger countries should treat smaller countries fairly.

“And this includes former colonial powers. It is not for them to lecture countries they once exploited on how to conduct their own internal affairs today,” the prime minister wrote.

The Philippines is a former Spanish and U.S. colony, and Malaysia a former British colony.

Najib is looking to strengthen ties with China after July lawsuits filed by the U.S. Justice Department implicating him in a money-laundering scandal. Najib has denied any wrongdoing and said Malaysia will cooperate in the investigations.

More than $3.5 billion was allegedly misappropriated from 1MDB, according to civil lawsuits filed by the Justice Department. The probe has strained ties between Malaysia and the United States, with Najib dismissing it as foreign interference in Malaysia’s affairs.

The shift by the Philippines and Malaysia is being widely seen as China’s counter to U.S. influence in the region.

Najib also wrote that disputes in the South China Sea should be resolved through dialogue in accordance with rule of law.

China claims most of the energy-rich waters through which about $5 trillion in ship-borne trade passes every year. Neighbors Brunei, Malaysia, the Philippines, Taiwan and Vietnam also have claims.

“When it comes to the South China Sea, we firmly believe that overlapping territorial and maritime disputes should be managed calmly and rationally through dialogue, in accordance with the rule of law and peaceful negotiations,” he said.

Chinese Vice Foreign Minister Liu Zhenmin said on Tuesday that Malaysia had pledged with Beijing to handle South China Sea disputes bilaterally.

Malaysia agreed to buy four Chinese naval vessels and signed 14 agreements totaling 143.64 billion ringgit ($34.25 billion), Malaysian state news agency Bernama said, after a meeting between Chinese Premier Li Keqiang and Najib on Tuesday.

Asked if the defense deals with Malaysia were Beijing’s bid to counter U.S. influence, Chinese Foreign Ministry spokeswoman Hua Chunying said the country consistently pursued the policy of being a good and friendly neighbor.

“And its foreign policy is not targeted at any third-party country,” she told a regular news briefing.

Najib also said Malaysia welcomed the China-backed Asian Infrastructure Investment Bank which marks a turning point “of peaceful dialogue, not foreign intervention, in sovereign states”.

Global institutions needed to be inclusive of “countries that were given no say in the legal and security infrastructure that was set up by the victors of the Second World War”, he added.