Pakistan's foreign ministry says Islamabad and Kabul are engaged in talks to deescalate tensions at a main border crossing between the two neighboring countries following this week's deadly clashes.

Outbreaks of shooting at the Torkham crossing have killed two Afghan and one Pakistani border guard and wounded at least 20 on both sides.

Spokesman Nafees Zakaria with Pakistan's foreign ministry told reporters in Islamabad on Thursday that he hopes the matter will be resolved soon.

He says the shooting first erupted after Pakistan started building a gate on its side of the Torkham border to curb illegal cross-border movement. He says Pakistan plans to build seven more such gates along the porous 2,200 kilometer (1,375 mile) -long border.

Torkham, a usually busy crossing, has remained closed because of continuing tensions.