Two American soldiers were shot dead on Thursday by two Afghans, including a man believed to be a soldier, Western and Afghan officials said, an attack likely to raise further questions about the future of Afghanistan's struggling security forces.

The killings in south Afghanistan came after two senior U.S. officers were gunned down in the Afghan Interior Ministry on Saturday by what Afghan security officials say was a police intelligence official.

At least five NATO soldiers have been killed by Afghan security forces since the burning of copies of the Koran at a NATO base last month triggered widespread anger and protests.

The killing of the U.S. officers in the Interior Ministry stunned NATO and cast doubt on its strategy of replacing large combat units with advisers as the alliance tries to wind down the war, now in its eleventh year.

NATO immediately moved to withdraw all its advisers from Afghan ministries in Kabul. Britain, Germany and Canada then withdrew their advisers.

The Obama administration will not swerve from plans to move into an advisory role in Afghanistan, U.S. officials say. But Afghan officials worry that further attacks by Afghan forces on Western troops could damage ties with NATO.

According to the U.S. Pentagon, about 70 members of the NATO force were killed in 42 insider attacks from May 2007 through to January 2012.

Such incidents became more frequent after the United States sent tens of thousands of more soldiers to Afghanistan as part of a surge to fight in Taliban strongholds.

There are Taliban sympathisers in uniform inside Afghan security forces who are not in fact sent or recruited by the Taliban, said an Afghan government official, who spoke on condition of anonymity.

Despite tighter vetting procedures, such unfortunate incidents do occur. This problem will not go away. We need more time, more resources and manpower.

Some of Washington's partners have shown even greater sensitivity to insider attacks. In January, French President Nicolas Sarkozy suspended training and support operations and announced that France would withdraw entirely by the end of 2013 after four French troops were killed by a rogue Afghan soldier.

The United States hopes Afghan forces will be able to confront the Taliban and handle security on their own before NATO combat troops' scheduled departure by the end of 2014.

Insider attacks on NATO troops have deepened doubts about the commitment and effectiveness of Afghan forces.

Unfortunately, this situation is a point of concern for us, General Afzal Aman, head of the operations department at the Ministry of Defence, told Reuters.

(Additional reporting by Mirwais Harooni and Hamid Shalizi; Editing by Robeert Birsel)