ISLAMABAD:-- A suicide bomber killed 35 people at a marketinfo-icon in northern Pakistaninfo-icon just hours after gunmen assaulted the Chinese Consulate in the southern city of Karachi, killing four.

The two attacks on opposite sides of the country were likely unconnected, but they underlined the myriad security challenges that Pakistan faces, including those from separatists as well as from the Pakistani Taliban based in the northern border regions.

The attacker in the northern Orakzai district drove a motorcycle into the heart of a weekly market in the town of Kalaya and detonated his explosives, according to Reuters.

Pakistani authorities have long battled militants in these remote regions near the Afghan border. The region has also been marked by tension between Sunni and Shiite Muslims, and the blast was near a Shiite mosque that may have been the target.

Video images from the scene showed volunteers and rescue officials recovering bodies from the weekly Friday market, where people had been buying vegetables, household items and warm clothes when the blast took place.

"There was a big bang that rocked the whole town. Nothing was clear in the smoke, and there were cries and screams from the market," said Ashraf Ullah, 42, a local merchant. "Many bodies were unrecognizable from damage by the blast. There were dead bodies all around."

The blast came hours after police in Karachi foiled a morning assault by three gunmen against the Chinese Consulate. The attack left two policemen, two civilians and the gunmen dead.

The assault took place at about 9 a.m., when the gunmen tried to enter the consulate located in the city's upscale Clifton area but were stopped by police and security guards at the checkpoint, local police officials said.

In addition to the exchange of gunfire, eyewitnesses told Pakistan's Dawn news channel that they heard an explosion. Footage broadcast on TVinfo-icon showed smoke rising from the Chinese Consulate building.

"Three attackers have been killed in the exchange of fire with our forces. All the Chinese diplomats and other staff at the consulate are safe, and they remained unharmed during the attack," Amir Shaikh, a senior police official, told journalists on the scene. Because of the quick response of police and guards, the terrorists could not reach the diplomats, he said. He added that a search was still underway to determine whether anyone else was involved.

According to Pakistani news channels, a separatist group, the Baluchistan Liberation Armyinfo-icon (BLA), claimed responsibility for the attack. The group opposes Chinainfo-icon's projects in the province and has previously attacked Chinese workers in Baluchistan, a Pakistani province at the heart of the mega project, the China Pakistan Economic Corridor (CPEC).

The $62 billion port and transportation corridor would connect far western China with the Indian Ocean via Kashmirinfo-icon's lofty mountain passes.

Prime Minister Imran Khaninfo-icon condemned the assault.

"The failed attack against the Chinese Consulate was clearly a reaction to the unprecedented trade agreements that resulted from our trip to China," Khan said on Twitterinfo-icon. "The attack was intended to scare Chinese investors and undermine CPEC. These terrorists will not succeed."

The attacks in both Karachi and the Orakzai district "are part of a planned campaign to create unrest in the country by those who do not want Pakistan to prosper," Khan added. "Let there be no doubt in anyone's mind that we will crush the terrorists, whatever it takes."

Earlier, Khan's office said in a statement that the Pakistani-Chinese relationship would never be undermined, since it is "mightier than Himalaya and deeper than Arabian Sea."

Chinese Foreign Ministry spokesman Geng Shuang condemned the attack and demanded that "the Pakistani side take practical measures to protect the safety of Chinese institutions in Pakistan."

The embassy in Islamabad, meanwhile, stressed the countries' close ties, saying that "any attempt to undermine the China-Pakistan relationship is doomed to fail."

Hassan Askari Rizvi, a Lahore-based security analyst, said the attack was aimed at just that, disrupting ties between the two countries. He noted that Chinese nationals have been attacked in the past.

"The terrorists want to create panic and fear, and an attack on a diplomatic mission creates international headlines," he said. "Such attacks show the threat of terror is still very much there, and it's far from over."