Taliban security forces killed two militants from the Islamic State group and detained a third in an overnight raid in the Afghan capital of Kabul, the spokesman for the Taliban government said Monday.

The regional affiliate of the Islamic State group — known as the Islamic State in Khorasan Province — is a key rival of the Taliban. The militant group has increased its attacks in Afghanistan since the Taliban takeover of the country in August 2021. Targets have included Taliban patrols and members of Afghanistan’s Shiite minority.

Separately, the Taliban gained control over the weekend of Afghanistan's Embassy in Iran, previously staffed with appointees of the U.S.-backed Afghan government, and on Monday appointed their own diplomats to the mission.

According to Zabihullah Mujahid, the main Taliban government spokesman, the Kabul operation took place in a residential neighborhood, targeting IS militants who were planning to organize attacks in the Afghan capital. He said the Kher Khana neighborhood is an important IS hideout.

IRAN BELIEVED TO HOUSE SUSPECTED NEW AL-QAEDA LEADER: UN REPORT

There was no immediate comment from the IS.

Mujahid said two IS members were killed and one was arrested, and ammunition and military equipment were seized in the raid. There were no casualties among the Taliban forces during in the operation, he added.

In a separate operation this month, Taliban intelligence forces killed three IS militants and arrested one in an overnight operation in eastern part of Kabul, in Karti Naw neighborhood. The Taliban had claimed that IS was behind organized recent attacks in the capital.

Afghanistan map

This is a locator map for Kabul, Afghanistan. Two militants with the Islamic State Group were killed by Taliban security forces in Kabul. (AP Photo)

Overnight, posts on on social media reported several explosions and small-arms fire in the area of Kher Khana.

The Taliban swept across the country in mid-August 2021, seizing power as U.S. and NATO forces were in the last weeks of their final withdrawal from Afghanistan after 20 years of war. The international community has not recognized the Taliban government, wary of the harsh measures they have imposed since their takeover, restricting rights and freedoms, especially for of women and minorities.

'WESTERN AGENDA': TALIBAN BAN SALE OF BIRTH CONTROL, ACCORDING TO REPORT

Afghanistan’s economy has been sent into a tailspin since the takeover, with millions driven into poverty and hunger. Foreign aid stopped almost overnight. Sanctions on Taliban rulers, a halt on bank transfers and frozen billions in Afghanistan’s currency reserves abroad have already restricted access to global institutions and the outside money that supported the country’s aid-dependent economy before the U.S. and NATO pullout.

In neighboring Iran on Sunday, authorities handed over control of Afghanistan’s Embassy in Tehran to envoys of the Taliban government. Previously, the embassy was staffed by the U.S.-backed Afghan government envoys.

The development was a win for the Taliban administration, which is expected to now fly the Taliban flag over the mission in the Iranian capital, not the Afghan flag.

There was no official comment from Tehran on the transfer of authority and it was unclear if that constituted an official recognition of the Islamic Emirate of Afghanistan, as the Taliban call their administration.

In Kabul, the Taliban Foreign Affairs Ministry in a statement said embassy "activities will continue in Tehran following the dispatching" of a new chargé d’affaires and diplomats from Afghanistan. The statement further stresses that changing mission diplomats abroad is the legitimate right of every country.

CLICK HERE TO GET THE FOX NEWS APP

"The new appointments," it said, would ensure "transparency in the affairs of the embassy as well as expanded relations in various fields between the two Muslim and brotherly countries."

Zia Ahmad, Taliban-appointed deputy spokesman at the foreign ministry, said Monday that Fazel Mohammad Haqqani, was named the new chargé d’affaires in Iran. The spokesman described the new envoy — as an "experienced" diplomat.

Ahmad said a seven-member team was sent to Tehran with Haqqani to provide services to Afghans in Iran.

This was "an important and helpful step in bilateral relations between Afghanistan and Iran," Ahmad added.