A policeman stands guard at the site of a 2015 bomb blast near the US Embassy in Kabul, Afghanistan Mohammad Ismail/ Reuters

The US Embassy in Afghanistan has closed following two deadly suicide attacks in the country targeting an American military base and a German consulate. A statement released from the embassy in Kabul said it will be "closed for routine services" on Sunday (13 November) as a "temporary precautionary measure", reported AP.

The unusual decision comes after four Americans – two soldiers and two contractors – were killed and 16 were injured in a blast at Bagram Airfield on Saturday.

Two days earlier, in a similar attack, six people were killed in the northern city of Mazar-i-Sharif and more than 115 were injured.

The Taliban took responsibility for both attacks.

Its spokesman, Zabihullah Mujahid, said the militants had been sent with "a mission to destroy the German consulate general and kill whoever they found there", following the attack on, according to Reuters.

That attack was said to be retaliation for air strikes near the northern city of Kunduz last week, which killed more than 30 civilians.

US Defense Secretary Ash Carter released a statement stating that US forces will stay resolute in their presence in Afghanistan despite the attacks.

"For those who carried out this attack, my message is simple. We will not be deterred in our mission to protect our homeland and help Afghanistan secure its own future," he said.

He also pledged that the Pentagon will investigate Saturday's attack to determine what steps could be taken to improve their protection for the base, which was one of the deadliest incidents involving US soldiers in several years.

President Barack Obama initially promised to have all US forces out of the country by the end of his first presidential term, but was forced to abandon that goal as Afghan forces struggled with the Taliban.

Under current plans, 8,400 US troops will remain as part of the Nato-led Resolute Support operation.