The army says it has secured territory across much of South Waziristan
Pakistani soldiers have raided a hospital in South Waziristan, killing at least four suspected militants and capturing 18, the military has said.
It said that the hospital, in the town of Wana, was being used by Islamist fighters operating in the area.
Those killed were believed to be of Arab and Sudanese origin.
The army has often said it is targeting foreign militants in Pakistan's north-western tribal areas, who it says form the backbone of the insurgency.
A security official told the BBC that the raid followed a tip-off that wounded militants were being brought to the hospital from Sherwangi, a Taliban-held area under attack by the army.
"Commandos and security forces raided the hospital. Militants fired on the troops and in the gunfight, which lasted more than four hours, four militants and a woman were killed, while 22 others were arrested," an official told the AFP news agency.
"One soldier was also injured. The three dead militants appear to be Arabs and one of Sudanese origin."
The identity of the woman was not initially clear, the official said.
Soldiers also captured 18 militants - some of whom were wounded - the army said.
But witnesses said that those arrested included hospital staff and patients with no apparent links to the Taliban.
A security official told the BBC that the operation continued until early on Thursday morning.
The hospital is owned by an influential cleric and former parliamentarian, Maulana Noor Mohammad, who is close to a major religious party of the country, the JUI(F).
South Waziristan is a Taliban stronghold targeted by the army in a major ground offensive in mid-October.
About 30,000 soldiers secured much of the tribal territory, but many militants are believed to have fled to other tribal areas in the north-west to avoid the fighting.
The offensive sparked a wave of violence in retaliation that has killed about 500 people over the past two months, including a bombing against a Sha Muslim procession in the southern city of Karachi on Monday that killed 44 people.
The Pakistani Taliban claimed responsibility for the bombing on Wednesday.