KABUL — The Taliban has warned the Islamic State to stay out of the conflict in Afghanistan, declaring that the fight against the country’s Western-backed government and the push for strict Islamic rule should be undertaken “under one flag and one leadership.”

The message was delivered in a letter addressed to Islamic State leader Abu Bakr al-Baghdadi. It comes amid fighting this week between Taliban forces and fighters aligned with the Islamic State in the eastern province of Nangahar.

“The Islamic Emirate of Afghanistan from a brotherhood point of religion wants your goodness and has no intention of interfering in your affairs,” reads the letter, which was sent to journalists on Tuesday. “Reciprocally, we hope and expect the same from you.”

The letter underscores the Taliban’s growing concern as it confronts divisions within its ranks. With its supreme leader, Mohammad Omar, not seen in years, the movement has become increasingly fragmented, divided over strategy and personalities. The Islamic State, an al-Qaida offshoot also known as ISIS or ISIL, has seized on the disaffection to recruit Taliban factions into its ranks, offering them funding and attention, according to analysts.

Although its numbers are small and it is battling in remote areas, the Islamic State’s entry has complicated the military and political landscape at a time when most international forces have left the country and Afghan security forces are struggling to fill the vacuum. U.S. military leaders have described the rise of Islamic State-aligned forces in the region as concerning, although those forces are not under the operational or tactical control of Baghdadi.

In recent weeks, the rival militants have battled in several provinces, with the heaviest fighting occurring in Nangahar, which is on the border with Pakistan. Former Taliban fighters now loyal to the Islamic State control the district of Kot, said tribal elders and provincial officials.

Abdul Ghafar, a lawmaker from Nangahar, said fighting is raging in Sherzad district over a strategic area where marble mines are located, offering a potentially lucrative resource for the Islamic State, should it seize control. The letter also appeared to send a message to Taliban commanders and fighters to remain united under the banner of the Taliban. In addition to Arabic, it was written in Dari, Pashto and Urdu, covering languages spoken in Afghanistan and Pakistan.

The letter noted that as a result of divisions in Islamist ranks during and after the Soviet occupation of the 1980s, “the blood of a million and a half martyrs during 14 years of holy war was wasted in Afghanistan.” It urged the Islamic State’s “friends” not to take actions that could lead to the “division of the Mujahideen’s command,” saying that schisms in its ranks could be manipulated by “enemies.”

“Jihad against the American invaders and their mercenaries in Afghanistan should be under one flag and one leadership,” the letter read.