China on Wednesday donated thousands of guns to Philippine President Rodrigo Duterte to help Manila in its battle against Islamist gunmen who are holed up in a southern city.

The small shipment of assault and sniper rifles and ammunition is the first example of Chinese military aid since Duterte threatened to move away from Manila's traditional ally America and seek Beijing's support.

The weapons shipment, worth some 50 million yuan ($7.35 million) "highlights the dawn of a new era in Philippine-Chinese relations", Duterte said.

Hours earlier, the military said they had found the bodies of 17 civilians killed by the Islamists, self-styled followers of the Islamic State movement (IS) who have besieged the city of Marawi since May 23.

Philippine troops, backed by airstrikes and artillery, have battled for over a month to drive the extremists out of Marawi but the militants have fought back.

Nearly 400 people have been killed, including 290 militants and 70 troops, according to official figures. Most of Marawi's 200,000 residents have fled and much of the city is in ruins.

"We are almost on bended knees sometimes because of lack of equipment. It is a good thing we have a good friend like China who is very understanding," Duterte said.

Duterte has been reluctant to acknowledge American help, saying recently that he had no knowledge about US technical assistance to the troops fighting in Marawi.

The Philippines, which has a mutual defence treaty with the United States, has long relied on US-supplied arms.

But in a swipe at America -- which has criticised his flagship war on drugs -- Duterte has said he will seek more weapons from China and Russia.

Chinese ambassador Zhao Jianhua, who formally handed over the weapons, said a "second batch" of weapons would soon be delivered.

"The donation is not big but it is big in the sense that it marks a new era in relations between our two militaries," the ambassador said.

"The Chinese side would like to explore the possibility of joint training, intelligence sharing and joint military exercises in the area of fighting terrorism," he added.

Duterte, who had declared martial law in the southern Philippines due to the Marawi siege, said he would not lift it until the military and police said conditions were safe.