Former nomad Gul Mohammad has not taken to a settled life. "I live in a jail now," the 45-year-old said, gazing out despondently at a livestock market from a breeze-block shed that doubles as a rough tea house. With 11 children his tiny house feels crammed, and the large herd of sheep that once allowed him to eat meat regularly are a fading memory.

Mohammad is a Kuchi, one of about 4 million Afghans whose tribes over centuries pursued a migratory, but often highly lucrative, life, herding caravans of sheep, goats and camels around the country, from warmer lowlands in winter to mountain pastures in summer.

Their black tents, colourful clothes and flocks sometimes hundreds of animals strong have become a classic symbol of Afghanistan. They also make a critical contribution to the country's economy and lifestyle, producing most of the raw materials for its much loved kebabs and famous carpets.

Yet the nomadic way of life has been rudely interrupted by war. Three decades of conflict have spared few in Afghanistan from upheaval, but Kuchis have been particularly vulnerable. They cannot claim protection from local commanders when the country fragments, because they move between areas.

"Each area fell under the control of one commander, who was king there," said Talib, who like many Afghans uses only one name and works at a major Kabul livestock market. "Commanders in each area did not care about night or day; they sent soldiers to seize our sheep or cows," he said, adding that he gave up his tent 10 years ago.

Hundreds of thousands have now settled down, or are petitioning the government for land so they can join a more mainstream way of life. A handful of people, such as Ashraf Ghani, a former presidential candidate, have become powerful businessmen and politicians.

Nearly 1 million others have partly settled, moving for the main change of the seasons, but fixed enough to have some access to schools and medical attention. Many in the government would like to see the remaining million or so who are still entirely nomadic shift to a settled life, because of concerns about widespread exclusion and poverty.

"The life of Kuchis and other Afghans is as different as sky and earth," said Ezatullah Ahmadzai, former head of the government's Kuchi independent general directorate.

Yet the Kuchi tradition is appropriate for Afghanistan's fragile and difficult terrain. Harsh deserts and soaring mountains are threaded with narrow green valleys of cultivated land. Outside the river valleys, thin soil and limited water mean most areas cannot support a large number of grazing animals for more than a few days or weeks.

"With the type of semi-arid and very arid environment you find in Afghanistan, it is nearly impossible to raise livestock in one location because you will damage the vegetation. After a few years it can't support them any more," said Mike Jacobs, a rangeland ecologist at Texas A&M university who has been working with Afghanistan's nomads since 2006. The Kuchi lifestyle, developed over hundreds of years, is an ideal adaptation to these conditions, allowing the country to raise tens of thousands of sheep a year, but limiting grazing in any single area.

A year-long survey of six of the country's main livestock markets by Jacobs' Pastoral Engagement, Adaptation and Capacity Enhancement (Peace) programme showed that more than two-thirds of animals sold in Afghanistan are raised by nomads.

But few Afghans, in government or outside it, appreciate that role. "Meat from Kuchis is a very low proportion of what you see in the shops, especially in the winter," said Sher Ali, 51, who started in the trade aged 10 and owns a shop on Kabul's butcher street.

His attitude is part of a larger problem of disregard for the Kuchis; although the livestock trade can be highly lucrative, their lack of education and the enforced simplicity of a nomadic life means they are often looked down on as stupid, dirty or backward.

The Kuchis are guaranteed 10 seats in parliament, but official positions are dominated by settled members of the group. Those who still live a nomadic life are marginalised even for a country where millions of people have minimal interaction with the government or any services it provides.

Few have birth certificates or other identity papers, needed for everything from land requests to school registration or medical care. Only four out of 100 Kuchis are able to read at present; many are keen for their children to be better equipped for modern life.

"We worry about our kids, we are like blocks of wood, with nothing in our minds," said Gul Agha, a 50-year-old elder from a camp of Kuchis petitioning the government in Kabul for land to settle permanently, in part so they can be nearer clinics and schools.

His group of about 75 families have been waiting more than two years in the capital, scraping a living by sorting rubbish for recyclable scraps.

About 18 months ago, they were promised land in nearby Laghman province only to be chased off the site by armed police; five Kuchis were killed in the clash. They returned to Kabul to ask once more for help, camp residents say.

That said, not everyone is keen to leave their tents. The livestock business can be very profitable, and some enjoy the freedom of a wandering life. "If you offered to make me a king, or give me back some sheep, I'd rather have my sheep and my old life with them," said Malik Durani, 46, who lives in the camp of Kabul petitioners.

Many educated, settled Kuchis dismiss the longing for the traditional way of life as nostalgic sentiment peddled to foreigners, or worse.

"These are businessmen who have part of the market cornered and don't want competition from other Kuchi," said Haji Sher Ali Ahmadzai, a member of parliament elected to one of the seats reserved for Kuchi. "Of course it is better to settle down," he said, waving at his warm, well carpeted office. "In the tents they don't have a bathroom, a stove, nothing."

There are serious political and economic concerns about trying to accelerate an enormous lifestyle shift in a country short of land and jobs for its urban population.

Jacobs supports finding permanent homes for those who want to settle down, but warns that a rush to end the nomadic lifestyle of all Kuchis would create problems in a country that has to import a significant amount of food.

"Trying to settle your nomadic populations, you're basically shooting yourself in the foot, you're going to have to start importing meat from other places," Jacobs said.

"Around 70% of the sheep and goats you see in the major livestock markets of Afghanistan comes from the Kuchi, and they only make up about 5% or 6% of the Afghan population. So it doesn't take a maths whiz to work out that maybe we should find a way to let the people who really want to raise their livestock this way, do that."

Additional reporting by Mokhtar Amiri © Guardian News and Media 2013