Militants attacked a Pakistani security post near the country's border with Iran on Thursday, triggering a shootout that killed two soldiers, the military said.

There was no immediate claim of responsibility for the attack in the area of Singwan in restive southwestern Baluchistan province. The military said the two slain troops "embraced martyrdom while fighting bravely against the terrorists."

The military launched a search and Iranian authorities were alerted to watch for the assailants trying to escape, the statement said.

PAKISTAN’S PRO-IMRAN KHAN TELEVISION JOURNALIST RETURNS HOME AFTER BEING RELEASED BY HIS CAPTORS

Fox News Asia graphic

A Militant attack on a Pakistani security post near the Iran border left two soldiers dead on Thursday.  (Fox News)

CLICK HERE TO GET THE FOX NEWS APP

The Iranian Embassy in the Pakistani capital condemned the attack and expressed condolences to the families of the two soldiers. In a post on Twitter, it urged for cooperation between the two neighboring countries "to combat terrorism."

Last month, five Iranian border guards were killed in a clash with an unknown armed group near the Pakistani border. Militants often target Pakistani and Iranian border guards in the region.

Small separatist groups in the oil-rich Baluchistan have waged a low-level insurgency for more than two decades. Baluch nationalists initially wanted a bigger share of the provincial resources, but later their insurgency morphed into a fight for independence from the government in Islamabad.