Unknown gunmen killed four Rangers personnel as they guarded a mosque in Karachi’s Ittehad Town on Friday.
The killers, on three motorcycles, opened fire outside the Abu Hurairah mosque.
One of the Rangers survived the assault but died later of his injuries, officials said.
The Rangers as well as the police have been engaged in a three-year long Karachi operation in the city, and come under attack by militants frequently.
Officials suggested the attackers intended to target the Sunni mosque during Friday prayers, when about 500 people were inside and in the adjoining madrassa.
“Perhaps the mosque and the affiliated madrassa were the target of the terrorists,” DG Rangers Major General Bilal Akbar told media at the spot.
“But our people defied them and embraced martyrdom,” he said.
In March a suicide bomber riding on a motorcycle rammed into a Rangers patrol van, killing at four soldiers.
Since January, 79 policemen have been gunned down in different parts of the city.