Afghanistan has released five UK nationals from detention, London said on Monday, adding that it regretted the episode and offering apologies to the authorities in Kabul.
"Pleased the UK has secured the release of 5 British nationals detained in Afghanistan," Foreign Secretary Liz Truss tweeted.
The Foreign Commonwealth and Development Office said in a separate statement that the five "had no role in the UK government's work in Afghanistan and travelled to Afghanistan against the UK Government's travel advice. This was a mistake."
No further details were given about the Britons nor when they were held and on what grounds.
On 12 February, the government in London said a "number" of British nationals were being detained and that it had raised the issue with the Taliban.
Among them was Peter Jouvenal, a journalist and businessman with a long association with Afghanistan, who was stopped last December.
The hardline Islamist group had the previous day released two overseas journalists who had been held, including a former BBC correspondent.
The FCDO added in its latest statement: "On behalf of the families of the British nationals, we express their apologies for any breach of Afghan culture, customs or laws, and offer their assurance of future good conduct.
"The UK government regrets this episode."