ISIS flag
In pictiure: An Islamic State flag hangs amid electric wires over a street in Ain al-Hilweh Palestinian refugee camp, near the port-city of Sidon, southern Lebanon January 19, 2016. [Representational image]Reuters File Photo

China said on Friday that it was "gravely concerned" at Islamic State claims that the group killed two Chinese teachers it kidnapped in Pakistan's Baluchistan province last month, where Beijing is investing billions of dollars in infrastructure projects.

China said it was working to verify the claim.

Armed men pretending to be policemen kidnapped the two language teachers in Quetta, the capital of the southwestern province, on May 24.

The kidnapping was a rare security incident involving Chinese nationals in Pakistan, where Beijing has pledged $57 billion under its massive "Belt and Road" initiative to build rail, road and power infrastructure.

China says Pakistan is a major part of its plans to build a modern day "Silk Road" network of land and maritime routes to connect Asia with Africa and Europe. Key parts of the infrastructure will be in Baluchistan, including the new port of Gwadar, which will be linked to western China under current plans.

The killing of the teachers was claimed by Islamic State's Amaq news agency on Thursday.

"Islamic State fighters killed two Chinese people they had been holding in Baluchistan province, southwest Pakistan," Amaq said.

A Baluchistan government spokesman said officials were in the process of confirming whether the report was correct.

China's Foreign Ministry expressed grave concern.

"We have been trying to rescue the two kidnapped hostages over the past days. The Chinese side is working to learn about and verify relevant information through various channels, including working with Pakistani authorities," the ministry said in a short statement.

"The Chinese side is firmly opposed to the acts of kidnapping civilians in any form, as well as terrorism and extreme violence in any form," it said.

There was no immediate comment from Pakistan's interior ministry or its foreign office.

Chinese state-run newspaper, Global Times, published by the official People's Daily, said in an editorial on Friday China would never bow in the face of terror, but also said Chinese people should also exercise greater caution abroad, especially in more remote areas.

"They also need to raise their ability to protect themselves, and as much as possible put distance between themselves and real danger," it said.

China has not formally identified the two teachers. Chinese media has cited foreign media reports as identifying the two as a man and a woman who worked for a private language school.

The claim of the killings sparked anger on Chinese social media with some strongly anti-Muslim comments.

Islamic State, which controls some territory in neighbouring Afghanistan, has struggled to establish a presence in Pakistan. However, it has claimed several major attacks, including one on the deputy chairman of the Senate last month in Baluchistan, in which 25 people were killed.

On Thursday, Pakistan's military published details of a three-day raid on a militant hideout in a cave not far from Quetta, saying it had killed 12 "hardcore terrorists" from a banned local Islamist group and prevented Islamic State from gaining a "foothold" in Baluchistan.

China's ambassador to Pakistan and other officials have often urged Islamabad to improve security, especially in Baluchistan.

The numbers of Pakistanis studying Mandarin has skyrocketed since 2014, when President Xi Jinping signed off on the China-Pakistan Economic Corridor.

Consequently, any attack on Chinese interests in Pakistan would come as an embarrassment to Islamabad, which greatly prizes its relationship with Beijing. The two refer to each other as "all weather friends".

Security in Baluchistan has improved in recent years, but separatists, who view infrastructure projects as a ruse to steal natural resources, killed 10 Pakistani workers building a road near the new port of Gwadar this month, a key part of the economic corridor.

China has also expressed concern about militants in Pakistan linking up with what China views as separatists in the far western Chinese region of Xinjiang, where hundreds have been killed in violence in recent years.