A British military spokesman in the Afghan capital, Kabul, told the Reuters news agency that the gunman may have been working with another man during the attack.
Gordon Brown, Britain's prime minister, said the deaths were a "terrible loss".
"They fought to make Afghanistan more secure, but above all to make Britain safer from the terrorism and extremism which continues to threaten us from the border areas of Afghanistan and Pakistan," he said.
Addressing the UK parliament, Brown said: "It appears that they were targeted because they were engaged in what our enemies fear most - they were mentoring and training Afghan forces.
"The Taliban have claimed responsibility for this incident, so it may be that the Taliban have used an Afghan police member or that they have infiltrated the Afghan police."
Speaking to Al Jazeera, Dr Aminullah Habibi, a research fellow at the UK Defence Academy, a training facility for the country's ministry of defence, said it was not surprising that the Taliban had appeared to have infiltrated the Afghan police.
Habibi said: "Afghanistan is a post-conflict country, infiltration in the police is not something difficult, it can happen.
"I think that the strategy to train the Afghan forces is right, and I think that's the only strategy, and it's good that the international community is taking that seriously.
"But I think that the tactics might be a bit different, simply because mentoring and staying with the officers could be dangerous because they have access all the time, staying with them, having food with them, staying in the same place day and night, that might make it easy."
The deaths bring the number of British troops killed in Afghanistan since operations began in 2001 to 229.