PESHAWAR, Pakistan -- At least 40 people were killed and nearly 100 wounded Friday in four separate bomb and gun attacks in three major Pakistani cities, officials said.

A suicide bomber was involved in the first car bombing near the office of the provincial police chief in the southwestern city of Quetta that killed at least 12 people and wounded 20. There were conflicting claims of responsibility for this attack from different extremist groups.

Hours later, twin bombings, minutes apart, hit a crowded market in a Shiite-dominated city in Parachinar, the main city in the Kurram tribal region and killed 24 people, mostly minority Shiite Muslims, according to government administrator Zahid Hussain.

Get Breaking News Delivered to Your Inbox

Friday evening, gunmen in the port city of Karachi attacked police officers at a roadside restaurant and killed four of them before fleeing, according to senior police officer Asif Ahmed.

The bomb and gun attacks come a few days before the Muslim holiday of Eid-al-Fitr, which ends the holy month of Ramadan. TV footage showed panicked people rushing to safety following the Parachinar market bombings.

Police and rescue officials cover a body after a blast in Quetta, Pakistan June 23, 2017. Naseer Ahmed/Reuters

Mohammad Amir, an official at a government-run hospital in Parachinar, said they had received 24 dead bodies and more than 20 of the wounded were listed in critical condition.

Hussain said a severed head of a man was found near the scene of blasts, indicating the second attack in Parachinar might have been carried out by a suicide bomber but officers are still investigating to determine the exact nature of bombings.

Parachinar is located about 300 kilometers, or 180 miles, southwest of Peshawar.

According to Pakistan's military, it was using two helicopters to transport wounded people to other cities. Prime Minister Nawaz Sharif condemned the attacks, saying terrorists were attacking soft targets.

Friday's car bombing in Quetta, the capital of Baluchistan province, was powerful enough that it was heard across the city, shattering windows on nearby buildings, said police spokesman Shahzada Farhat.

Pakistani nursing staff attend an injured girl at a hospital in Quetta, Pakistan, Friday, June 23, 2017. Arshad Butt / AP

Wasim Beg, a spokesman at a government hospital, said the death toll from the bombing had risen to 12 throughout the morning and some of the wounded remained in critical condition.

TV footage showed several badly damaged cars and a road littered with broken glass.

Hours after the attack, Jamaat-ul-Ahrar, a breakaway faction of the Pakistani Taliban, claimed responsibility. Asad Mansoor, the militants' spokesman, vowed more such attacks as part of the extremist group's campaign aimed at imposing Islamic laws in the country.

Later Friday, the Islamic State of Iraq and Syria (ISIS) said in a competing claim that it was behind the attack, adding that one of its followers targeted the police post in Quetta, detonating his suicide belt there. It also released a photograph of the alleged attacker, identified as Abu Othman al-Khorasani.

The competing claims could not be reconciled.

Anwarul Haq Kakar, a spokesman for the provincial government, blamed neighboring India for the blast but offered no evidence to back up the allegation.

Pakistan and India routinely trade charges of interference and inciting attacks on one another's soil.

On Thursday, Pakistan said that an Indian naval officer, Kulbhushan Jadhav, who was sentenced to death by a Pakistani military court on charges of espionage and sabotage, had petitioned for mercy.

Jadhav, who Pakistan said had crossed into Baluchistan from neighboring Iran, was arrested in March 2016 and sentenced to death in April.

In New Delhi, the Ministry of External Affairs insisted Jadhav was sentenced on "concocted charges" and expressed doubts about the existence of the petition for mercy. It also reiterated that the proceedings against Jadhav have been shrouded "in opacity."

Baluchistan has long been the scene of a low-level insurgency by Baluch nationalists and separatists, who want a bigger share of the regional resources or outright independence, but also attacks blamed on the Pakistani Taliban and others. Those militant groups include Lashkar-e-Jhangvi, which is considered a close ally of IS, as well as Jamaat-ul-Ahrar, which has taken credit for several previous attacks in Baluchistan and elsewhere and has bases in Pakistan's tribal regions.