At least 12 people were killed and 40 wounded when two bomb blasts went off outside a district court in northwestern Pakistan, a rescue official said.

The attack on Friday in front of the court in the town of Mardan in Khyber-Pakhtunkhwa province was the latest in a string of violent attacks to have hit Pakistan in recent weeks.

"So far we recovered 12 bodies of the lawyers, police personnel and civilians. Besides this, we rescued 52 injured, including lawyers, police personnel and civilians from the spot," Haris Habib, chief rescue officer in the city of Mardan in Khyber Pakhtunkhwa province, where the blasts took place, told the Reuters news agency.

Earlier, four suicide bombers who were trying to attack a Christian colony were killed during a gunfight with security forces outside the northwestern city of Peshawar, the army said.

Soldiers backed by army helicopters fought back the fighters who had tried to attack the colony near Warsak Dam, just north of Peshawar.

Asim Bajwa, an army spokesman, said "all four suicide bombers were killed" in the operation carried out against the fighters on Friday and that a clearance operation was under way.

Local sources, though, told Al Jazeera that at least one civilian was killed and several wounded in the attack, which was claimed by the Pakistan Taliban-linked Jamaat-ur-Ahrar group. 

Two of the four suicide bombers detonated their vests and the other two were shot dead, the sources said.

The Pakistan army launched Operation Zarb-e-Azb under US pressure in 2014, in a bid to wipe out fighters and their bases in the North Waziristan tribal area.

Source: Al Jazeera News and agencies