The landscape of Dhani-Ghorri in northern Afghanistan is a quilt of fields outlined by earth berms, poplar trees and irrigation canals. Driving into the district to meet the area's Taliban commander late last month, we passed men and boys who cooked rice in mud kilns, piled sacks of red onions on trucks or followed herds of goats and sheep.

Our escorts were a mix of Afghan ethnicities – Uzbek, Hazara, Tajik and Pashtun – from Baghlan and its neighbouring provinces. Most surprising, though, were the two who said they lived in Britain.

We were asked to wait for the district chief in the house of a burly, bearded man who spoke passable English with a hint of a London accent. For most of the time he lived in east London, he said, but he came to Afghanistan for three months of the year to fight. He was a mullah and had the rank of a mid-level Taliban commander.

"I work as a minicab driver there," he said. "I make good money, you know. But these people are my friends and my family and it's my duty to come to fight the jihad with them.

"There are many people like me in London," he added. "We collect money for the jihad all year and come and fight if we can."

He shared the compound-style house in Dhani-Ghorri with his brothers and sisters and their families. The oldest brother, a senior cleric or maulvi, also lived in London. Of his two younger brothers, one lived in Dubai and the other – a red-bearded young man who sat in the corner flipping prayer beads and whispering – in Norway.

The fighting season was coming to a close, they said, and the four of them were getting ready to return to their civilian lives abroad.

Our host explained the delay in the district chief's arrival: he was resolving a dispute between two villages and would arrive soon.

A succession of bearded farmers who had just finished their work in the fields arrived at the house while we waited, bringing with them a smell of sweat and mud. They chatted about the operation of the day before, when one of their comrades attacked a Nato convoy wearing a suicide vest. He had successfully gained martyrdom by killing himself in the operation, they said.

When Lal Muhammad, the district chief, entered the room, all the men jumped to attention.

Lal Muhammad is a short and stern 32-year-old madrassa teacher. In his crisp blue shalwar qameez and dark brown glasses it was easier to imagine him giving a class in theology than leading men in battle. He sat down with his legs crossed, savouring the silence and his authority. He would explain how in three years his band of Taliban had grown to supplant the government as the real rulers of the district. First, though, he would show me a film on his mobile phone.

The district chief

"We have to document everything," said Lal Muhammad. "We take the film to our leaders in Pakistan to show what kind of work we are doing and take orders." The video showed one of his first operations, when his men had hijacked seven green Afghan police pickup trucks and disarmed dozens of uniformed Afghan policeman. The police lined up along the side of a dirt road, while the star of the scene, Lal Muhammad, dressed again in freshly laundered shalwar qameez, strutted around with the police commander following sheepishly behind.

A policeman emerged from behind a mud wall, handed over his weapons and went to stand with the rest. "If they just surrender like these men did we take their weapons and release them. If they fight back then we kill them."

Three years ago, he and a few other madrassa teachers started fighting small-scale skirmishes against the government.

"There were people in the village and in the madrassa who liked the Taliban and wanted them back, but the government was strong then and they even controlled the countryside. We held meetings with the mullahs of the mosques. They supported us because we were fighting the foreigners, so we collected some weapons."

"Twelve Kalashnikovs," said the burly English Talib.

"In the first two operations the fighters were just madrassa teachers and students," said Lal Muhammad. "We arrested the police, burned their cars and distributed their weapons and the mujahideen started the fight. We met the mullahs again after that and told them we could now defend ourselves. They gave us their blessing."

As Lal Muhammad's reputation grew, others came to join him. "When the old Taliban heard about us they started joining us. Students from madrassa here and from Pakistan came to work in jihad and help us."

Eventually blessings arrived from the Taliban leadership in Quetta and two Komissyons – Taliban councils – were established, one civilian and one military. He continued to teach in the local madrassa not far from the village.

"Most of this area is now in the hands of the Taliban," he said. "Every week we do two to three activities. Sometimes we close the highway and search the cars, sometimes we attack the police and sometimes we attack Nato fuel tankers."

A boy came into the room with a glass of water. Lal Muhammad whispered words into the water and blew into it three times.

"For blessing the water to the people of the house he is a religious man and people love him," said the British Talib.

Lal Muhammad stood up again and the men jumped on their feet. They followed him out into the small dirt lane outside the house where they knelt, washing their face and hands and feet in a small irrigation ditch, then into a one-room mud mosque where he led them in prayer.

The fighters

After lunch, Lal Muhammad took us out into the countryside to inspect his fighters. "He is taking you to see all of this because you are an Arab," the British Talib told me.

We squeezed into the back of an old Toyota with a bespectacled Arabic teacher who jammed a Kalashnikov between his knees and a young farmer who cradled a machine gun. Lal Muhammad sat in the passenger seat and the red-bearded Talib who lived in Norway drove the car.

We sped along a narrow dirt road blaring out Taliban music. The red-bearded Talib sang along, turning to me every few minutes, a big smile on his freckled face, and translating the words: "O martyr, march to the enemy …"

We stopped in a small bazaar between two rows of mud-walled shops. There was a doctor's clinic, a pharmacy, a school. Two women in blue burqas sat on the edge of the road waiting for a taxi and a few children ran around them.

I counted 14 Taliban in dirty tunics, glittering caps and turbans who lounged in the shade of the shops or manned a checkpoint in the road, stopping donkey carts and taxis. The men stood to attention at the presence of Lal Muhammad. They formed a wobbly line under the piercing gaze of their commander, a tall thin man with small hard eyes and a walkie-talkie who was stopping the cars and looking inside.

The second Taliban post was in an Uzbek village. During previous visits to the Taliban in the north I had seen that the movement was predominantly Pashtun, but in the last year Uzbek and Tajik units have started to emerge in Baghlan, Faryab and other provinces.

"They are in control in their areas," Lal Muhammad told me. "We armed them and gave them the weapons. They are independent in their area, but under the leadership of the Taliban movement."

Most of these fighters were young teenagers, but the commander was an old Uzbek who had fought in the civil war in the 1990s. Why was he fighting again? "Because the foreigners are here," he said.

After we left the village, Lal Muhammad told me: "Everywhere you see the Taliban you have to understand that the Taliban grow among the people. We can't survive in an area without the people's support, the mosque is our station, the houses are our station, the madrassa is our station. Each RPG rocket cost us 1300 afghanis ($26). Every day I do operations and use rockets. How could I do that if people weren't paying for us?

"Yesterday there was a suicide car bomb attack. The people in the village bought him the car, not me."

The third outpost was more like an army camp. A hundred men had gathered in an orchard. They were subdivided into smaller groups, each one led by separate commander and based in separate village or a farm. The youngest group was made up of teenage boys from the madrassa armed with ancient second world war-era rifles. They wore black turbans and their eyes were lined with black kohl.

Someone shouted out and quickly the groups dispersed, on foot or on motorbikes. Lal Muhammad stood at the gate shaking hands and accepting greetings.

Back at the compound of the English Talib, many of the commanders who were in the orchard sat around Lal Muhammad. They included Haji Saleh, an old man in his sixties who said he first started fighting the foreigners 31 years ago. That time they were called Russian, he said, but they are the same, all kafirs.

Haji Saleh's job was laying mines. "I go at night to lay mines and traps in the road," he said. He worked with another fighter, Bilal, who was the electronics expert of the group.

Bilal, who was from eastern Afghanistan, was also called Engineer Sahib because he had an engineering degree from a university in Pakistan.

Bilal spent the night teaching his comrades how to bring down helicopters ("Shoot at the rotors. Don't shoot when it's coming at you shoot at it from behind") and told me their comrades in Pakistan supplied them with Google Earth maps that they used to locate government bases and identify targets for their mortars.

Haj Saleh gave Bilal a small plastic landmine, Bilal inserted some metal screw like object and twisted it, then both of them left. When they came back an hour later Bilal's hand was covered with a metallic silver layer that was burning his skin.

After dinner, Lal Muhammad excused himself and left the compound. He slept in a different house every night to avoid assassination attempts, I was told.

Before we went to sleep, the Talib from east London showed me pictures on his mobile phone of friends who had been killed in the fighting. He smiled as he looked at the pictures, but there were tears in his eyes.

The battle

The Americans began their assault in the middle of the night. We were woken at 2am when a man burst into the room shouting: "Where are the rockets? The Americans are landing!"

Somewhere in the darkness outside we could hear the sound of a helicopter landing. The windows rattled and the house shook.

"Where are the rockets?" shouted the man again, his voice trembling with fear and anger.

Machine-gun fire was crackling from all over the village. A second helicopter could be heard circling over the house. The windows rang in resonance with its rotor blades, a low jingling hum that grew louder and louder until it was drowned out by the roar of the rotors.

Bilal, who had been asleep in the corner of the room, threw off his blanket, sprang to his feet and ran out of the house. In the courtyard the burly English Talib stood in the courtyard firing his Kalashnikov into the night air. A white muzzle flash flickered through the window against the wall and lit the room.

When the rockets arrived, the Taliban fired three of them from the road outside the compound. They landed in the distance with a loud thud.

The Americans retaliated with a missile that struck the wall in front of us. Machine guns rattled continuously in the background: the metallic sound of Taliban Kalashnikovs fighting the slower staccato of the American weapons.

Then the Taliban were firing mortars from the yard of our compound, each bomb making a metallic whoosh followed by a thud.

An hour later, I could hear the helicopters circling away and the battle subsided into an intermittent exchange of bullets. The English Talib came into the room again and said Bilal had been captured by the Americans and the Taliban would attack the area where the Americans had landed and try to free him.

The battle resumed, this time from multiple directions as the Taliban pressed the attack. The helicopter gunship returned quickly, flying low and unleashing volleys of cannon fire before circling again for another run. It seemed for a while that the Taliban had stopped fighting apart from few stubborn shooters.

At around 4.30am another helicopter flew in and landed nearby, the vibration snapping open the house's windows so that cold wind and dust filled the room.

The gunfire reached a crescendo as Afghans and Americans emptied their magazines in the same time. Then the helicopter rose and left. The silence that ensued was broken by a hoarse voice calling for prayers and subdued shouts of "Allahu Akbar!"

The battle – one of the many that occur every night in Afghanistan between American special forces and Taliban fighters – had lasted three hours.

The martyr

Even before the Talib with the red beard was declared dead, a woman began to cry, her subdued sob drifting over the silent village. Dawn was beginning to break when the body was brought into the courtyard, wrapped in a red blanket with yellow flowers tucked under the Talib's chin and showing only his face. He was laid on the floor. Someone lit his face features with the light from a mobile phone. Whether it was the weak light or the dust caking his face, the dead man now looked grey.

The crying woman's voice was drowned now by the wails of the others. The dead Talib's younger brother hugged the body and wept.

"His passport was ready," he cried. "He was leaving in three days!"

More fighters, guns slanted over their shoulders, stood in the shadows watching the scene in silence.

The dead Talib's son, a young boy with a white prayer cap, came out of the house, his face wet with the tears that were pouring down his checks. A woman in a blue burqa and red pyjama trousers ran into the courtyard sobbing. She stopped metres from the body, turned and walked away and then turned again and tried to come closer. She stopped again, crying and ran away, the blue fabric fluttering behind her.

The British Talib crouched in a corner against a wall, his face contoured, his mouth quivering, tears rolling down his cheeks and into his beard.

By now the body was surrounded by fighters. They moved their fingers in his hair, wiped his face and kissed his hands. They lifted the blanket to look at the small hole in the side of his head and examine his bloodstained chest.

Now and then the crying younger brother would break off from his obsessive pacing to tuck the blanket under the corpse's chin as if to guard him from the morning chill.

The body was carried into the women's section of the house and the wails were unbearable even for those hard peasant fighters. They shuffled out of the house, some crying, some silent, to stand in the road outside.

More casualties were brought in, including a young boy who lay in the back of a car with his shirt soaked in blood, his hand covering the socket of his right eye which was oozing liquid down his face.

His father was the Arabic teacher, who had also been injured. There was another Talib who had been killed, the men said. By now the red-bearded Talib's son was running around like a mad animal screaming "Revenge! Revenge! By the name of God!"

Around seven in the morning, Bilal arrived at the compound – he hadn't, after all, been captured by the Americans. He ordered the fighters to disperse in case a drone saw them, then turned to me.

"We want you to come with us," he said. "We have a few questions to ask you."