The US launched an airstrike today against Taliban fighters in retaliation for the killing of at least 20 Afghan soldiers and policemen in a string of attacks.

It was the first strike by American forces since a troop withdrawal agreement was signed between the two sides on Saturday as part of a historic peace deal.

Taliban militants killed Afghan soldiers and police officers on Tuesday night, just hours after US President Donald Trump said he had a 'very good' chat with their political chief.

The militants have ramped up violence against Afghan security forces in recent days, ending a partial truce put in place during the run-up to a landmark US-Taliban withdrawal deal signed in Doha on Saturday.

Insurgents launched attacks on at least three army posts in Kunduz and attacked police in central Uruzgan province on Tuesday night.

In response the Pentagon launched a strike in Afghanistan's southern Helmand province, a US forces spokesman said today.

Afghan Taliban fighters and villagers attend a gathering in Alingar district of Laghman Province on the day the militants said they were resuming operations against Afghan government targets

Afghan Taliban militants and villagers celebrating the peace deal and their victory in the Afghan conflict on US in Afghanistan, in Alingar district of Laghman Province on Monday

Taliban militants killed Afghan soldiers and police officers on Tuesday night, just hours after US President Donald Trump said he had a 'very good' chat with their political chief

US Forces-Afghanistan spokesman Sonny Leggett tweeted: 'The US conducted an airstrike on March 4 against Taliban fighters in Nahr-e Saraj, Helmand, who were actively attacking an #ANDSF checkpoint. This was a defensive strike to disrupt the attack.'

He added: "We call on the Taliban to stop needless attacks and uphold their commitments. As we have demonstrated, we will defend our partners when required."

Leggett said insurgents had carried out 43 attacks on checkpoints in Helmand on Tuesday alone.

Provincial police spokesman Mohammad Zaman Hamdard said: "In the past two days we have witnessed the most intense Taliban attacks in Helmand. They have attacked several districts and many military bases."

News of the airstrike in southern Helmand province - the first in 11 days - came hours after Donald Trump told reporters he had had a 'very good' chat with the Taliban political chief.

Donald Trump confirmed on Tuesday that he spoke on the phone to a Taliban leader, making him the first US president believed to have ever spoken directly with the militant group responsible for the deaths of thousands of US troops in nearly 19 years of fighting in Afghanistan.

A defence ministry official speaking on condition of anonymity confirmed the Afghan army death toll last in the recent attacks night, while the provincial police spokesman Hejratullah Akbari confirmed the police fatalities.

Afghan security officials patrol in Helmand, Afghanistan, yesterday. Afghan President Ashraf Ghani said his government had not pledged to free Taliban prisoners

President Trump had sharp words for the government of Afghan President Ashraf Ghani, suggesting they were doing well financially from the prolonged presence of American troops

Safiullah Amiri, a member of the provincial council, said: 'Taliban fighters attacked at least three army outposts in Imam Sahib district of Kunduz last night, killing at least 10 soldiers and four police.'

The insurgents also attacked police in central Uruzgan province on Tuesday night, with the governor's spokesman Zergai Ebadi saying: 'Unfortunately, six police were killed and seven wounded.'

The violence has cast a pall on the nascent Afghan peace process, with the insurgents clashing with Kabul over a prisoner exchange ahead of talks that are due to begin on March 10.

On Tuesday Trump told reporters in Washington that he had a 'very good' relationship with Taliban political chief Mullah Baradar, with the pair speaking on the phone for 35 minutes, according to the insurgents.

'The relationship is very good that I have with the mullah. We had a good long conversation today and you know, they want to cease the violence, they'd like to cease violence also,' he said.

Trump has touted the Doha deal as a way to end the bloody, 18-year US military presence in Afghanistan - right in time for his November re-election bid.

Under the terms of the deal, US and other foreign forces will quit Afghanistan within 14 months, subject to Taliban security guarantees and a pledge by the insurgents to hold talks with the national government in Kabul.

Afghan Taliban militants and villagers in Alingar district of Laghman Province on Monday. The Taliban said they were resuming offensive operations against Afghan security forces, ending the partial truce that preceded the signing of a deal between the insurgents and Washington

Afghan civil society activists holding banners in Dari that reads: 'We cannot forget the court-martials, Taliban crime in Afghanistan, Taliban group are the factor of destruction and genocide' as they chanted slogans against the US agreement with the Taliban

The agreement also includes a commitment to exchange 5,000 Taliban prisoners held by the Afghan government in return for 1,000 captives - something the militants have cited as a prerequisite for talks but which President Ashraf Ghani has refused to do before negotiations start.

Trump said the Taliban and Washington both 'have a very common interest' in ending the war.

He had sharper words for Ghani's government, however, suggesting they might be 'reluctant' to pursue a deal.

'They've done very well with the United States for many years -- far beyond military if you look at all the money that we spent in Afghanistan,' he said.

Since Saturday's deal signing, the Taliban have been publicly claiming 'victory' over the US and on Monday they announced they would resume attacks on Afghan national forces.

The halt to the limited truce, which began on February 22, ended what was a welcome reprieve for ordinary Afghans who have born the brunt of the deadly violence.

Ghani's government last week sent a delegation to Qatar to open 'initial contacts' with the insurgents, but Taliban spokesman Suhail Shaheen on Tuesday said the militants would not meet Kabul's representatives except to discuss the release of their captives.

Apparent differences between the Doha agreement and a separate joint US-Afghan declaration made in Afghanistan underline the obstacles facing negotiators.

The US-Taliban deal committed to the release of prisoners, while the Kabul document only required both sides to determine 'the feasibility of releasing' captives.