QUETTA, Pakistan -- The attack on the Chinese consulate in Karachi last week is a sign that the Pakistani government may be struggling to contain anti-China sentiment at an awkward time when it is asking Beijing for financial assistance to avert a balance of payments crisis.

The latest attack came in the morning of Nov. 23, as three militants of a splinter group of Baloch Liberation Army stormed into the Chinese consulate in Pakistan's biggest city of Karachi. Security guards shot dead the gunmen, and two policemen and two civilians were also killed.

The attack failed to hurt any of the 21 consulate staff, but it underscores BLA's determination to disrupt China's influence in the country and also raises worries about its capabilities. BLA claimed responsibility for the attack on Twitter even while it was ongoing and released a prerecorded video of the gunmen on social media after they were killed.

In the video, the attackers warned China that if it continued to exploit Balochistan's natural resources, "it will again face the wrath of Baloch youth."

Friday's attack was not the first time that BLA had targeted Chinese. In August, a BLA suicide bomber attacked a bus carrying Chinese engineers in the town of Dalbandin in western Pakistan.

"BLA is targeting Chinese interests in Pakistan, first, as a way to put pressure on China to withdraw from Balochistan and, second, to put pressure on the Pakistani government," said Andrew Small, senior transatlantic fellow with German Marshall Fund's Asia Program. He adds that attacks on Chinese targets are politically sensitive for Pakistan.

So far, the attacks have only taken place in the southern provinces of Balochistan and Sindh, where many development projects are being carried out under the $62 billion China-Pakistan Economic Corridor -- a massive series of projects that include a network of highways, railways and energy infrastructure that span the entire country.

Chinese interests in north Pakistan have not faced any threats, as BLA has no presence in that part of the country. Small believes that BLA is explicitly trying to target CPEC and create difficulties for the initiative.

CPEC is a flagship project in China's ambitious Belt and Road initiative, and key to Pakistan's economic development as it struggles to keep creditors at bay. Any further attacks may give Beijing jitters about whether it can continue to send workers to the country, making it necessary for Pakistan to reassure China over the safety of its citizens.

The Pakistani government blames India for such attacks on the CPEC. Saleem Khosa, home minister of Balochistan province, alleged that Indian spy agency R&AW orchestrated the Karachi consulate attack by BLA. Umar Khattab, a senior counterterrorism official investigating the Chinese consulate attack, claimed that the mastermind of the attack had received medical treatment in India.

Prime Minister Imran Khan is certainly in a difficult position, as his government is trying to ink a deal with Beijing for a huge financial bailout. Pakistan needs $12 billion to avert a balance of payment crisis. Islamabad has secured $6 billion from Saudi Arabia and Khan has been knocking on the doors of China and the United Arab Emirates for bilateral loans.

Khan recently visited Beijing and China showed willingness to assist Islamabad, although more negotiations were needed to finalize details of the package. The insurgents have now weakened Islamabad's negotiating position, experts said.

Khan sounded defiant in the aftermath of Friday's attack, saying that the "terrorists will not succeed." His government is also clamping down on anti-China sentiment.

A video went viral on social media last week that claimed a Pakistani student named Usama was stabbed to death by the father and brother of his Chinese girlfriend. Khan's government was quick to react and the foreign office issued a statement denying Usama's stabbing and claimed instead that he had committed suicide.

Beijing has also shown satisfaction with Islamabad's response to Friday's attack. In a statement, the Chinese embassy in Pakistan said it "appreciate[s] the Pakistani Army and Police for their timely and proper action against the attack." It added that "any attempt to undermine [the] China-Pakistan relationship is doomed to fail."

For now, these positive statements point to a strong relationship between the two countries. But further attacks on Chinese assets in Pakistan could test that relationship and Khan's government is now under pressure to ensure it has the situation under control. The stakes on both sides are high -- for Pakistan, a lifesaving bailout; for China, its long-term outlook for the BRI.