Iran will not allow the Islamic State group to establish a presence on the country's border with Afghanistan, President Ebrahim Raisi warned on Saturday

"We will not allow terrorist organis ations and IS to set up next to our border and strike other countries and the region," Raisi said as he wound up a visit to Tajikistan.

"The presence of IS in Afghanistan is dangerous not only for Afghanistan but also for the region," he told state television.

The Taliban took Afghanistan's capital on August 15, exploiting a vacuum caused by the withdrawal of US troops from the country and a collapse by the Afghan army.

Iran, which shares a 900-kilometre (560-mile) border with Afghanistan, did not recognise the Taliban during their 1996 to 2001 stint in power.

But Tehran has appeared to soften its tough stance towards the Sunni militia in recent times in the name of pragmatism.

The Islamic republic has stressed that the Taliban must be "part of a future solution" in Afghanistan.

Afghanistan's new rulers have formed a government composed entirely of Taliban and belonging almost entirely to the Pashtun ethnic group.

"A government belonging to only one ethnic or political group cannot solve Afghanistan's problems," Raisi said on Saturday, calling for a government with representation for all Afghans.