PESHAWAR - Two Pakistani soldiers were killed and one injured in cross-border firing near the Afghan border in the restive northwest, officials said Sunday.

"Two soldiers were martyred and one injured when militants from Afghanistan opened fire on Pakistani troops," a senior security official told AFP on condition of anonymity.

He said the incident took place in the Barmal area of South Waziristan, which shares its borders with Afghanistan's Paktika province.

The incident was confirmed by local administration officials and other senior security sources. No one immediately claimed responsibility for the attack.

According to an ISPR press release, unknown people fired from Afghan side on a checkpost at Baramal area. As a result two Pakistani army soldiers Idrees and Arshad embraced martyrdom while Saeed was injured.

The security forces gave a beffiting response, the statement added.

In May this year, the Pakistani army claimed to have cleared the last militant stronghold in the country's northwest after a months-long operation.

The army launched the operation in mid-2014 to wipe out militant bases in the area and end the near decade-long insurgency that has cost Pakistan thousands of lives.

The operation was intensified after the Taliban massacred more than 150 people, the majority of them children, at a school in Peshawar in December 2014.