PESHAWAR, Pakistan (Reuters) - Three Pakistani soldiers were killed in an ambush in the northwestern city of Peshawar on Sunday, militants said, in an attack for which both Islamic State and a Pakistani Taliban faction claimed responsibility.

Militants said they ambushed an unmarked vehicle ferrying soldiers on Sunday morning near the congested Daudzai area of Peshawar. Military sources confirmed the attack but said the killed men were army employees and not soldiers.

The Pakistan army often uses unmarked vehicles for transportation of soldiers and other employees in volatile areas around Peshawar to avoid being identified and attacked.

"They were traveling in a civil van when unknown armed men opened fire at them," said a security official who declined to be named. "Three of them died on the spot."

Pakistan's military this month declared that it had foiled Islamic State's attempts to establish operations in the country. But the group's Amaq news agency said Islamic State was behind the ambush, also claimed by Jamaat-ur-Ahrar, an offshoot of the Islamist militant Pakistani Taliban group.

Jamaat-ur-Ahrar, which carried out the Easter Sunday bombing in Lahore in which 70 people were killed, at one time swore fealty to Islamic State's Middle East leadership, but later switched back to the Taliban.

The two groups also both claimed responsibility for a suicide bombing at a hospital in the Pakistani city of Quetta that killed 74 people last month.

Pakistan's military said on Sept. 1 it had arrested more than 300 Islamic State militants and sympathizers, thwarting the ultra-hardline group's attempts to expand there.

But concern has been growing that Islamic State - which controls parts of Iraq and Syria and is known for especially brutal treatment of religious minorities - might replicate their model in Pakistan, especially after Islamic State loyalists seized small pieces of territory in neighboring Afghanistan.

On Friday, Pakistani authorities said they arrested four Islamic State militants plotting attacks in the city of Lahore. The four men had 1.6 kg (3.5 lb) of explosives as well as fuses and detonators, officials said.

Most Islamic State recruits in the region are believed to be Pakistani or Afghan defectors from other Islamist movements.

Pakistan is home to several militant groups including the Afghan and Pakistani Taliban, al Qaeda and the Haqqani network, giving Islamic State both a rich pool of potential recruits but also fierce competition.

Islamic State last year declared Afghanistan and Pakistan as the state of "Khorasan", part of its self-declared global caliphate, and appointed longtime militant Hafiz Saeed Khan as its regional leader.