The United States has conducted an airstrike against the Taliban in Afghanistan after President Donald Trump boasted he secured peace with the group.

Military officials confirmed on Wednesday the airstrike was to interrupt a planned attack on a checkpoint run by the Afghan National Defence and Security Forces (ANDSF).

The strike was from a drone, according to military officials.

"The US conducted an airstrike Wednesday against Taliban fighters in Nahr-e Saraj, Helmand, who were actively attacking an #ANDSF checkpoint. This was a defensive strike to disrupt the attack. This was our 1st strike against the Taliban in 11 days," US Forces in Afghanistan Spokesman Colonel Sonny Leggett wrote in a series of tweets.

"On March 3rd alone, the Taliban conducted 43 attacks on #ANDSF checkpoints in #Helmand. The Taliban claim to be fighting to free Afg. from int'l forces, the Feb 29 agreement provides a conditions-based path to withdrawal," he added.

The spokesman was referring to an agreement signed last Saturday between the US and the Taliban that would significantly decrease the number of troops in Afghanistan.

At least 25 Afghanistan soldiers were killed and 13 others were injured in three separate Taliban attacks, military officials confirmed to CNN.

Hours before the drone attack by the US, Mr Trump spoke to Taliban co-founder Mullah Abdul Ghani Baradar over the phone.

The president then boasted about the conversation with reporters, saying: "I had a very good talk with the leader of the Taliban. We've agreed there's no violence. We don't want violence."

“We'll see what happens,” he added. “They're dealing with Afghanistan. But we'll see what happens.”

Under the peace deal signed last Saturday, the US agreed to reduce the number of military troops in Afghanistan with plans to completely withdraw from the country in 14 months. In return, the Taliban said it would "not allow any of its members, other individuals or groups, including al Qaeda, to use the soil of Afghanistan to threaten the security of the United States and its allies."

Mr Leggett said the US is committed to creating peace in Afghanistan with the Taliban but the country would not abandon its allies, which include the ANDSF.

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