Insurgents' trip to Tehran presented as meeting of governments, which is likely to fuel reports of co-operation between countries

A delegation of senior Afghan Taliban members have made an historic trip to Iran to meet with officials, putting aside enmity for a meeting likely to worry both Washington and Kabul.

The insurgents' spokesman presented the visit, first announced by Iran's semi-official Fars news agency, as a meeting of two governments, rather than rebels with a neighbour.

"They travelled to Tehran on the invitation of Iranian officials," said spokesman Qari Yousef Ahmadi, adding that a group of Taliban clerics had also attended a religious conference on "Islamic Awakening".

The main delegation also asked the government to "resolve immigration problems", Ahmadi said, a clear populist appeal to the millions of Afghans either living in Iran or with a relative there.

Many fled during the civil war and never returned, and tens of thousands more try to slip in illegally each year in search of war. But with the Iranian economy straining under sanctions, Tehran has stepped up deportations, angering many who want Kabul to respond more strongly.

The official visit was a surprise in part because there is a long track record of hostility between the Sunni Taliban and Iran's Shia authorities. In the late 90s 11 Iranians, mostly diplomats, were killed in the chaotic days when the northern city of Mazar-i-Sharif fell to the Taliban.

Iran said at the time that it held the Taliban, who already ruled Kabul, responsible for the deaths. With tens of thousands of Iranian troops deployed along the border there were fears it could escalate into conflict. Although the tensions were eventually defused, mistrust lingered.

But the Taliban are now fighting US and other western forces in Afghanistan, while the Iranians are struggling with a tight US-led sanctions regime, and aimed at curbing its nuclear programme.

For years there have been reports of co-operation between Iran and the Taliban, including training and weapons sales, as pragmatic leaders focused on their shared enemy and tried to ignore their turbulent past.

With the departure of most Nato troops at the end of next year and regional powers jostling for influence in Afghanistan, the meeting also served as a convenient reminder to canny Afghan politicians that they should not take Iranian government support – whether in cash or other forms – for granted.

Although Iran is often seen as closest to the largely Shia Hazara ethnic group, the invitation to the Taliban underlined that its diplomacy is driven as much by pragmatism as religious loyalty.

The Iranian embassy in Kabul could not be reached for comment on the trip, and the US embassy and presidential palace did not respond to requests for comment. Neither are likely to be happy to see the Taliban acting like government-in-exile at the invitation of a neighbour.

The delegation was made up of some senior Taliban members who have been living in Qatar for several years, Pakistan's Express Tribune reported. Washington and Kabul agreed in 2011 to the creation of a Taliban office in the country, to facilitate peace talks.

Suicide attackers posing as Taliban envoys have attacked senior officials including former president Burhanuddin Rabbani, who was killed by a bomb concealed inside a turban. By providing an address and recognisable negotiators, the office was intended to eliminate the chances for this kind of attack.

Both the US and Afghan government, however, have said repeatedly that they would not tolerate the office being used for fundraising or diplomatic work – which was exactly what the delegation that travelled to Iran appeared to be doing.