Image copyright AP Image caption Afghan National Security Forces rely on billions of dollars of international funding

UK Prime Minister David Cameron has said that British troops will return from Afghanistan having accomplished the main aim of their mission - to achieve a basic level of security.

But how secure is Afghanistan, and what shape is the country in? BBC World Service reporter Dawood Azami takes a look at the challenges Afghanistan faces today.

Security

Security remains the country's biggest test.

It is true that al-Qaeda has been driven out of Afghanistan and it doesn't have any sanctuaries inside the country. But the Taliban are still a potent force - they are active in many parts of Afghanistan and even control a few districts in the south and east, including Helmand province where British forces have been based.

The international community has helped raise and train the Afghan National Security Forces (ANSF) that now number almost 350,000.

But since the handover of security responsibilities from Nato to Afghan forces in June 2013, the Afghan National Army (ANA) and Afghan National Police (ANP) have seen a dramatic rise in casualties - raising questions about the sustainability of the Afghan forces.

While Afghan officials are largely confident about the capabilities of their troops, they have complained about the lack of proper equipment, especially heavy weapons, as well as about not having "a proper air forces with enough trained pilots and aeroplanes".

Civilian casualties from the armed conflicts remain high, with the United Nations reporting that more than 2,700 civilians have been killed and nearly 5,000 injured - the majority by armed groups - in the past year alone. And there have been reports of abuse by the Afghan Local Police (ALP).

Many people, especially in the south and east, also complain about Nato's night raids and house searches.

The high cost of maintaining the Afghan security forces is another major challenge - one estimated to reach about $5bn (£3.3bn) a year.

Without continued international financial assistance, the Afghan government would not be able to afford such a force on its own.

A number of western countries, including the US, UK and Germany have signed strategic partnership agreements with Afghanistan, committing themselves to training Afghan forces after 2014.

But the US and Afghanistan are still discussing a separate security accord which would allow a number of US combat forces to remain in the country. The outcome of that deal is expected to determine whether other countries decide to keep any soldiers or trainers in Afghanistan.

Drugs

Drug production has increased in many areas of Afghanistan since the US-led invasion in 2001.

Afghanistan now produces some 90% of the world's opium.

Image copyright AP Image caption Afghanistan produces 90% of the world's opium

Despite years of international efforts to curb drug production in the country, a 2013 UN report found that opium growing has reached a record level, with more than 200,000 hectares under cultivation for the first time.

The drug economy is funding the insurgency and the Taliban reportedly receive an estimated $100m (£66m) annually from taxing poppy farmers and drug traders.

The drug trade also fuels official corruption and has intensified a domestic addiction crisis in the country which now has more than a million addicts.

Economy

Afghanistan has received tens of billions of dollars in aid over the past 12 years. The country has seen a great deal of development and life has improved for millions of Afghans.

Thousands of kilometres of new roads have been built and the health sector has progressed with clinics built in even remote districts.

Thousands of new schools have also been built where millions of boys and girls are receiving education.

A number of towns and cities have seen so much development that in the words of an Afghan, "even their maps have changed".

Afghans are now connected to each other and the rest of the world via telephone and the internet.

Image copyright Reuters Image caption Many children are deprived of basic education facilities

Some 20 million mobile phone subscriptions have been set up in a country of 30 million people. The mobile telecommunications sector is a major driver of the economy and is the largest taxpayer and the biggest non-governmental employer, aside from subsistence agriculture.

But Afghanistan is still one of the poorest countries in the world. There are still places in the country which have not felt the benefits of international aid.

Many children are still deprived of education and do not have access to basic facilities such as clinics and clean water.

Afghans in general say that a lot of aid money has been wasted and that the international community should have invested in major infrastructure projects such as building dams, housing schemes and industrial zones.

Overall, the Afghan economy is largely dependent on foreign aid and drug income.

Institutions

Afghanistan's institutions were destroyed in the two decades of war that preceded the US-led invasion.

The process of institution building has had tangible success and the country has functioning institutions in the capital, Kabul, as well as in provinces and most districts.

Afghanistan is back on the international stage, with diplomatic missions in some 70 countries and representation in most international organisations.

But there are problems with a lack of governance or bad governance in many parts of the country.

The Berlin-based institute, Transparency International, put Afghanistan, North Korea and Somalia in the last place in its 2013 corruption index.

Afghan officials say they are committed to tackling corruption, which they say exists largely in the services sector. They also point to "the big corruption" that they say takes place in awarding international contracts.

Peace process

Realising that the war in Afghanistan has reached a "stalemate", the Afghan government and its international backers started a peace process in 2010.

The main parties in the Afghan peace process are the Afghan government and its High Peace Council, the US and the Taliban - but none of them agree on the terms and conditions of talking to each other.

There have been meetings and contacts between different parties over the past two years. But efforts to launch a formal peace process have not been successful so far.

Image copyright AP Image caption President Hamid Karzai reacted angrily after the Taliban opened an office this year

In June this year, the Taliban opened an office in the Qatari capital, Doha.

It was the first time that the Taliban had a known address and authorised representatives who could openly talk.

But the office was closed soon after, with Afghan President Hamid Karzai reacting angrily to the Taliban opening their post with their flag and plaque bearing an inscription of the Islamic Emirate of Afghanistan - the name the Taliban government used when they came to power in the 1990s.

Contact is being made with individual Taliban members and leaders, but the process exists only in name and no major breakthrough has been made so far.

The Taliban say they will keep fighting as long as foreign forces are present in Afghanistan.

Human rights

Afghans in general are anxious about the achievements of the past decade as the 2014 deadline for withdrawing international combat forces looms.

The country has an active civil society and a vibrant media with dozens of national and provincial television stations.

But freedom of expression and access to information are two of the many challenges journalists still face.

Image copyright Reuters Image caption Women have the right to work and vote but violence and discrimination continues

Women have the right to work and are members of the National Assembly and provincial councils.

Rule of law and access to justice is one of the biggest challenges despite some government efforts to improve the situation.

And violence and discrimination against women has been a big issue.

The ongoing conflict has prompted more families to flee their homes, with an estimated half a million people still displaced within the country living in informal settlements with inadequate shelter.

Around three million refugees remain outside the country, mainly in Pakistan and Iran.