Donald Trump has said Pakistan would help the US "extricate" itself from Afghanistan. (File)

The Afghan Taliban has expressed willingness to travel to Pakistan and meet Prime Minister Imran Khan if he invites them for negotiations to end the 18-year conflict in Afghanistan, according to a media report.

The statement by the Taliban came hours after Imran Khan returned to Islamabad after his maiden official visit to the US where he discussed the Afghan peace process with US President Donald Trump on Monday and agreed to work together to end to the conflict.

During the meeting, President Trump said that Pakistan would help the US "extricate" itself from Afghanistan, adding there was "tremendous potential" in the relationship between Washington and Islamabad.

Sohail Shaheen, a spokesman for the Taliban's political office in Qatar's capital Doha, told the BBC Urdu that if Prime Minister Khan extended a formal invitation, they will accept it.

"We frequently visit countries in the region and would surely go to Pakistan, too, which is our Muslim neighbour, if there is a formal invitation from Islamabad," he said.

Media reports say the US is negotiating for a deal by September 1 that would see international forces pull out of Afghanistan in return for Taliban security guarantees, including a pledge that Afghanistan will not become a safe haven for terror groups.