Image copyright STR/AFP/Getty Images Image caption Staff at Wazir Akbar Khan hospital treated the wounded

The Taliban has said it carried out an attack in Afghanistan on the base of the British security firm G4S.

A British man was among five employees killed when gunmen stormed their compound.

G4S, one of the world's largest security groups, helps guard the area around the British embassy in Kabul.

The US-led invasion of Afghanistan in 2001 contributed to a boom in the private security business.

In recent years, the presence of contractors has decreased, mirroring the withdrawal of foreign troops. However, insecurity in Afghanistan remains widespread, there are still thousands of Nato troops and the demand for armed security at foreign embassies, military bases, and for NGOs is still high.

So how many private security firms are operating in Afghanistan?

The Afghan interior ministry says the government-run Afghan Public Protection Force (APPF) carries out most of the security tasks in Afghanistan today. Responsibilities include escorts for foreign troops and other security services for NGO, diplomatic or business clients.

The body was created by a presidential decree in 2010 that banned all private security companies after a series of scandals.

Up to that point a large number of foreign private security contractors had overseen most of the security jobs.

Image copyright AFP Image caption The Afghan Public Protection Force (APPF) was given the task of taking over security roles in Afghanistan

What does a private security company do?

According to a UN working group, a private security company does the following work:

Armed guarding or protection of buildings, installations, property and people

Knowledge transfer with security and policing applications

Development and implementation of security measures

However, the international community in Afghanistan pushed back on the ban and raised concerns about the fitness of the new government security plan. Foreign diplomatic sites, international organisations with diplomatic status and military bases were able to retain their own firms. The exemption also applied to companies involved in police training missions.

Foreign security firms were also allowed to re-register as a risk management company.

This allowed many companies to keep a footing in the security business, wrote Fabrizio Foschini in 2014 for the Afghanistan Analysts Network.

A private security company could be hired to vet, train and manage the guards employed by the Afghan government.

So there is still a presence of foreign security companies working in Afghanistan today.

G4S, for example, says they have about 1,200 members of staff in Afghanistan and have been in the country since 2003.

Half of the workforce is Afghan and the other half is made up of foreign nationals, including Brits.

Aside from providing security at the British embassy, the company has other private security contracts for NGO and corporate clients. The company trains and employs security guards and is involved in the training and mentoring of Afghan national forces.

Non-disclosure

It's very difficult to get exact numbers for the private security industry operating in Afghanistan, says Sorcha MacLeod from the UN Working Group on the use of mercenaries, which also looks at private security companies.

Information is difficult to access because client governments can withhold it on national security grounds. It's also because of the complex nature of the industry - there are parent companies, sub-contractors and joint ventures working there.

There have been calls for a bigger role for private companies in the Afghan war.

Erik Prince, the founder of Blackwater, a private security firm, believes contractors are key to ending the long-running war. He wants to pay "proven veterans" who have served in Afghanistan and use them in combat.

Former Afghan president Hamid Karzai called the proposal a "blatant violation of Afghanistan's national sovereignty".

Media playback is unsupported on your device Media caption WATCH: Ex-Blackwater CEO's plan to end Afghan war

The numbers have certainly decreased since the significant withdrawal of US and Nato troops in 2014.

In 2012, for example, there were more than 100,000 contractors - armed and unarmed - employed by the US Department of Defense. That included more than 20,000 private security contractors.

The number of private security contractors went below 1,000 at the end of 2016, but has slightly increased since then.

In October 2018 there were almost 2,500 armed private security contractors in Afghanistan, according to the US Department of Defense. Most are third country nationals - that is neither American nor Afghans.

However, armed contractors are always only a small subset of contractors in Afghanistan, says Ulrich Petersohn, associate professor in international politics at the University of Liverpool. The bulk of the contractors are unarmed and provide maintenance or logistics.

All contracting companies had to make their own security arrangements, which, in turn, at the height of the military presence increased the overall number of security firms.

Out of the 25,000 total US defence contractors in Afghanistan now, about 10,000 are American citizens.

Aside from security services, which account for 16% of the contracting jobs, roles include logistics, translation, base support, construction and transportation.

Read more from Reality Check

Send us your questions

Follow us on Twitter