Gunmen attacked the Chinese consulate in the southern Pakistani port city of Karachi early on Friday, killing two policemen and wounding a security guard, officials said.

Security forces killed three attackers to end an hourlong shootout, Karachi police chief Ameer Sheikh told reporters outside the consulate.

"They could not even get in the compound," Ameer Ahmad Sheikh said, contradicting other reports that the gunmen had entered the building.

A Pakistani separatist group has claimed responsibility for the attack.

"China is exploiting our resources," a spokesman for the so-called Balochistan Liberation Army said in a telephone call to Reuters news agency.

All staff safe

The consulate is home to Chinese diplomats and other staff. Pakistan's foreign minister, Shah Mahmood Quershi, said all 21 staff were safe and had been moved to a safer location.

China has recently been pouring billions of dollars into Pakistan as part of its huge Belt and Road infrastructure initiative.

Pakistani Prime Minister Imran Khan has ordered an inquiry into the attack, according to his office, which called it an attempt to undermine economic and strategic cooperation between the two countries.

Read more: Pakistan: Asia Bibi and the countless victims of blasphemy laws

'Mightier than the Himalayas'

Khan said in a statement that Pakistan's relations with China could not be shaken by such incidents, calling bilateral ties "mightier than the Himalayas and deeper than the Arabian Sea."

China condemned the attack and called on Pakistan to protect Chinese citizens and institutions.

In a separate attack on Friday, a bomb killed at least 35 people at a market in the town of Klaya in the Orakzai region of the Khyber Pukhtunkhwa province, which borders Afghanistan. More than 50 were wounded in the attack, and authorities say the death toll could rise.

Read more: Tackling Pakistan's pathetic economy: Is Imran Khan up to the task?

Watch video 03:03 Share Defusing explosives in Pakistan's perilous northwest Send Facebook google+ Whatsapp Tumblr linkedin stumble Digg reddit Newsvine Permalink https://p.dw.com/p/38gZf Defusing explosives in Pakistan's perilous northwest

tj/sms (Reuters, AFP, AP)

Each evening at 1830 UTC, DW's editors send out a selection of the day's hard news and quality feature journalism. You can sign up to receive it directly here.