Having been engaged in fierce battles against each other for over a year in Afghanistan, Islamic State and Taliban militants have agreed a truce to counter US-backed forces in the region, military officials told American media.

Afghan government forces have been using the rivalry between Islamic State (IS, formerly ISIS/ISIL) and the Taliban to push the latter’s forces back from the territories under their control. But several months ago the conflict died out as the two terrorist groups seemed to have reached a shaky truce, Afghan officials say.

“They [IS] fought deadly battles with the Taliban before. But over the past two months, there has been no fighting among them,” the Wall Street Journal cites Mohammad Zaman Waziri, who commands Afghan troops in the east of the country, as saying.

The truce enabled Islamic State to regroup and concentrate on engaging Afghan forces in Nangarhar and Kunar provinces, which used to be an Al-Qaeda stronghold, media report.

NATO-trained Afghan forces only control about two-thirds of country’s territory, overrun by Taliban https://t.co/bEzKWLvfzF — RT (@RT_com) July 29, 2016

Infiltration of Islamic State emissaries into Afghanistan began last year. Apart from spreading the group’s influence into new territories, IS has pursued a policy of gaining control of heroin production in Afghanistan and trafficking it via territories controlled by the terrorists.

After the Russian task force in Syria launched a vast air campaign against IS targets and struck a heavy blow to its oil infrastructure, officials say that the issue of controlling heroin routes became even more important for the terrorist group. According to the Russian Federal Drug Control Service (FSKN), terrorists have been making $1 billion a year from Afghan heroin.

The Taliban has been around in Afghanistan for the last two decades while IS emerged as a terrorist group in 2014. Though the Al-Qaeda offshoot treats other extremist groups in the region with skepticism, it has opted for a “non-aggression pact” with IS.

#Kabul LATEST:

- Death toll climbs to 80

- 230+ injured

- ISIS claims responsibility https://t.co/EF3DIzeeo5 — RT (@RT_com) July 23, 2016

IS claimed responsibility for the recent terrorist attack in Kabul that took the lives of over 80 people.

Militants from the group are also trying to establish contact with Afghan locals by joining prayers in mosques and promoting their beliefs. In the poorest areas they offer salaries to those ready to join their ranks and fight government troops.

“They want to brainwash the youth. They are spreading propaganda against the foreign troops and the government,” the WSJ quoted Malak Khan Bacha, a tribal elder in Sarkani district.

The US command is expanding its operations in Afghanistan by pulling in more troops. American top brass believe it would prove hard for terrorists to maintain a solid peace deal.

“There's still a conflict even though they may have a local ceasefire in place,” said Army Gen. John Nicholson, the top US military commander in the country.

IS claims it has acquired a variety of US weapons and sensitive radio equipment in Afghanistan following recent battlefield victories, posting pictures of documents, photographs and US ID cards online. The weaponry allegedly belonged to American soldiers, but none was captured in the area at the time, according to the Military Times.

Middle Eastern affairs expert Ali Rizk said that “a larger percentage of Taliban would be supportive of some kind of informal alliance or a ceasefire with Islamic State.”

Rizk told RT: “Of course, the Taliban leader, Akhtar Mansuri, is considered to be quite right-wing, maybe closer to Daesh (IS) than some other elements (within the group).”

The biggest loser in this situation is the Obama administration, which “has invested a lot in Afghanistan,” the expert said.

“For Obama, to leave office with there being some kind of alliance between a part of the Taliban and IS that’s’ a very big setback because Obama always said that it was his war as opposed to Iraq, which he objected to,” Rizk said.