Image caption The Taliban chose Qatar for the office because they saw it as a neutral location

After nearly 12 years of bloodshed in Afghanistan, long-awaited peace talks with the Taliban are set to begin. But why and how have these negotiations ended up taking place in the Gulf emirate of Qatar? The BBC World Service's Dawood Azami has this assessment from Doha.

Taliban representatives secretly arrived in Qatar about three years ago to talk to Western officials. They knew that the Americans in particular were eager to secure a peace deal that would allow Nato a dignified exit from Afghanistan and leave the country more stable and peaceful.

In March 2012, the Taliban suspended initial talks with the US focused on prisoner exchanges.

They wanted the release of five Taliban figures held at Guantanamo Bay in exchange for the freedom of US soldier Sgt Bowe Bergdahl, believed to have been held by the Taliban since 2009.

But the number of Taliban representatives and their activities in Qatar have gradually increased. There are now more than 20 relatively high-ranking Taliban members who live here with their families.

Over the past two years, they have sent representatives from Qatar to conferences on Afghanistan in Japan, France and Germany - most recently sending a delegation to Iran.

Those in Qatar represent only the Taliban in Afghanistan, the main insurgent group led by Mullah Mohammed Omar. There are no representatives of the Pakistani Taliban.

Shopping encounter

Nearly all members of the Taliban office are said to have come to Qatar through Pakistan. A few have reportedly commuted between Qatar and Pakistan over the past two years.

While in Doha, the Taliban have in general been careful about their activities and appearances.

But it is not a big city and there are about 6,000 Afghan labourers and businessmen who live here. Several told me that they had occasionally seen Taliban representatives driving, walking the streets, or inside shopping centres and mosques.

Senior Taliban in Qatar Mohammad Tayeb Agha is the head of the Taliban office in Doha and the most prominent Taliban representative in Qatar. He is well respected within the Taliban leadership for his intelligence and his closeness to overall Taliban leader Mullah Mohammed Omar

is the head of the Taliban office in Doha and the most prominent Taliban representative in Qatar. He is well respected within the Taliban leadership for his intelligence and his closeness to overall Taliban leader Mullah Mohammed Omar Mawlawi Shahabuddin Delawar is a well-known religious scholar and served as a former Taliban ambassador to Saudi Arabia

is a well-known religious scholar and served as a former Taliban ambassador to Saudi Arabia Mohammad Naim is the main spokesman of the Taliban office in Qatar

is the main spokesman of the Taliban office in Qatar Qari Din Mohammad Hanif is an ethnic Tajik and was the minister of planning in the Taliban government

is an ethnic Tajik and was the minister of planning in the Taliban government Shir Mohammad Abbas Stanakzai served as a former Taliban deputy foreign minister

served as a former Taliban deputy foreign minister Mohammad Suhail Shahin worked in the Taliban's Islamabad embassy and their information ministry. He was also in charge of the English-language Kabul Times paper.

A diplomat from the Afghan embassy in Doha shared the story of an encounter he had had with a Taliban representative in a Doha shopping centre.

"I approached a couple of children when I heard them speaking in Pashto," he said.

"I recognised the man with the children, but when he avoided disclosing information about himself. I asked him: "Are you from the other side?' He blushed and simply left."

The diplomat also said that like other Afghans, some Taliban visit the Afghan embassy to register the birth of a child or renew documents.

"They live in Doha in comfortable homes all paid by the Qataris, who are generally nice people," Doha-based Afghan businessman Zadran Darwesh said.

"A Taliban member once told me that he had seen war and fighting for 30 years but now wanted to live in a peaceful environment."

For years, the Afghan government and its Western backers have been trying to contact the Taliban, but they did not have a known address.

As a confidence-building measure, providing protection to those Taliban leaders participating in peace talks and finding them a permanent address became a priority for the US and the Afghan High Peace Council.

The council was established after a 2010 Jirga - a council of tribal delegates - in Kabul, which was tasked with contacting the Taliban and convincing them to join the peace process.

The Afghan government was keen on opening an office for the Taliban in Turkey or Saud Arabia, because it thought those countries were more influential and had a closer working relationship with Kabul.

'Cordial relations'

But the Taliban's preferred venue was Qatar because they considered it a neutral location. They see Qatar as a country that has balanced relations with all sides and has a prestigious status in the Islamic world.

The US was also happy with this option.

Image caption The opening of the Taliban office has brought Qatar the international limelight it appears to seek

Afghan officials say that President Hamid Karzai finally gave the green light to the office after receiving guarantees that it would maintain a low profile and work only as a venue for peace talks.

The president did not want it to be used for other activities, such as the expansion of Taliban ties with the rest of the world, recruitment or fundraising.

All the sides have their reasons to support talks in Qatar:

the US wants Sgt Bergdahl to be released as part of some sort of deal with the Taliban

the Taliban want the release of their members from the US military-run prison camp at Guantanamo Bay, to reduce their dependence on Pakistan, and raise their profile internationally

the Afghan government wants to create distance between the Taliban and Pakistan, and for Taliban members to be able to participate in talks without risking arrest by Pakistan

the Pakistani government wants to show that it does not control the Taliban and that they are based in Qatar rather than Pakistan

the Qatari government, for its part, insists that it wants to help, seeking to project itself as the main mediator in a prolonged conflict

Qatar was not one of the three countries - Pakistan, Saudi Arabia and United Arab Emirates - which recognised the Taliban regime in Afghanistan between 1996 and 2001. But according to a former Taliban foreign ministry official, it did have "cordial" relations with the militants.

After the Taliban regime was toppled, its leaders did not have a place of refuge.

A few high-ranking figures sought asylum in Qatar, but their requests were quietly declined or ignored for a number of reasons, including because their names were on the UN/US sanction list, or they were wanted by the US.

'Arab Kissinger'

However, some lower-ranking Taliban managed to travel to Qatar and other Gulf states, such as UAE and Saudi Arabia, as ordinary Afghan labourers and businessmen.

Qatar Population of 1.9 million, but just 250,000 are citizens

Home to the al-Jazeera satellite TV network

Has played active role in Arab uprisings

Hosting 2022 football World Cup Change in the wind for Qatar Qatar's delicate balancing act

They were neither high-ranking and nor well known, and could mix easily with the Afghan diaspora in the Gulf.

About two years ago, the former Guantanamo prisoner and Taliban ambassador to Pakistan, Mullah Abdual Salam Zaif, also moved from Kabul to Qatar with his family after his name was removed from the international sanctions list.

Qatar, the tiny but wealthy Sunni Muslim Gulf state, has become famous for punching above its weight. It became a household name when it started the famous al-Jazeera television network.

It also got involved in a number of international crises as a mediator - including the conflict in Sudan's Darfur region and the rift between the Palestinian factions, Fatah and Hamas.

And it has been involved actively in the Arab Spring uprisings, supporting the armed rebellions in Libya and Syria.

Sheikh Hamad bin Khalifa Al Thani, Qatar's ambitious 61-year-old emir, is reported to be preparing to hand control of the wealthy Gulf state to his son, Crown Prince Tamim bin Hamad Al Thani. He is well known for his diplomatic activism, with various media outlets calling him the "Arab Henry Kissinger".

So the opening of the Taliban office has brought Qatar the international limelight it craves. The challenge is how to make this new hub for peace talks become a true success story.