The mullah, his imposing white beard grazing the ground, knelt and prostrated himself in the direction of Mecca. The 80 men lined up behind him in the large, bright mosque followed him down to the ground in unison. He shifted to half-face the congregation and intoned:

"Let us pray to Allah that we, his warriors, his mujaheddin, may join hands in unity under his guidance, so that we may rid our country of those that have no religious book, the godless usurpers from the north, and bring about the freedom of our country."

The men, again in unison, mumbled amin, the Afghan equivalent of "amen." The early-afternoon prayer was over, and the meeting of Islamic insurgent leaders continued in this village fewer than 20 miles from the base of their Soviet enemy in the capital of Kabul.

The conference Oct. 24 was the first to bring together leaders of all the guerrilla groups operating in southern Afghanistan. In a country where fierce factional disputes have bedeviled the resistance, it illustrated a growing awareness of the need for greater unity. While this meeting ended without taking concrete steps, two broad alliances of the insurgents were formed earlier this year, one of fundamentalist Moslem groups and the other of more moderate ones.

The signs of cooperation offer hope for a strengthening of the resistance, but to some extent they also reflect an underlying weakness. The groups are pulling together after three years of war in part to counteract the sapping of resources of the villages from which they draw support, and the organized resistance groups across the Pakistani border in Peshawar are unable to provide enough money to pay the guerrillas. Meanwhile, Soviet and Afghan government security services are believed to have launched a major campaign to infiltrate the resistance.

The disunity among the mujaheddin has been caused not so much by ideological disagreements as by longstanding ethnic and tribal differences, the competing personal ambitions of various leaders and quests for regional dominance. All of the groups seek some kind of Islamic state, although members of the more fundamentalist groups tend to view Islam more as an ideology than as a faith.

The most virulent antipathy always has been between the two most extreme fundamentalist parties, reflecting the rivalry between the nation's two principal ethnic groups. One of these mujaheddin groups is led by a Tajik, Burhannudin Rabbani, and the other by a Pathan, Gulbuddin Hekmatyar.

Some observers had expected the December 1979 Soviet invasion to have a unifying influence, but little changed during the first two years that followed it.

The fratricidal attitude was particularly common among the party leaders vying for dominance in Peshawar, the insurgents' effective capital-in-exile. Guerrilla leaders inside Afghanistan often found it necessary to cooperate to fight off Soviet attacks.

Even in the field, however, commanders have been unwilling to accept a unified command structure out of fear that they then would lose personal authority. Different guerrilla groups also have competed for food or other support from local villages and occasionally even fought among themselves.

The two broad alliances were formed after slow and painful deliberation because of the awareness that the mujaheddin might find it difficult otherwise to sustain the resistance at its current level. Regular meetings of "alliance committees" now are held, and membership cards of the approximately seven former parties have been abolished.

Even the party leaders in Peshawar have begun putting aside their differences. They sent the mullah who led the prayers at the meeting here as part of a three-man commission with the express task of convening the special conference in hope of promoting cooperation or even integration among the guerrilla factions.

Present were the two major commanders in the area, Haji Siddiq and Zabit Abdul Halim, who later was killed. There also were representatives of every resistance party, fundamentalist or moderate.

Unity cannot come about overnight, however. The meeting lasted seven hours, full of powerful and flowery rhetoric, but it ended with only a broad agreement to hold further talks.

Cooperation both within the two principal alliances and between them remains superficial and uneasy. Weapons still are distributed along old party lines, and finances are regulated separately.

One major factor in the push for unity has been the need to contain factional rivalries that were alienating local villages already suffering from the consequences of the war.

Halim, the commander whom I accompanied during a stay of almost two months in the area south of Kabul, was aware of it. The topic was raised at every meeting that he had with village elders in the outskirts of the capital, where men under his command were deployed, and the villagers appeared to feel increasing bitterness about some of the demands made on them by the insurgents.

"Due to the war, a lot of land is now left idle, and the people in the villages are less well off. This would not be so serious if they only had to aid one party, but three or four different groups have to be helped here, given food, maybe cigarettes, clothes," he said in an interview before he was killed.

The resulting bitterness and growing weariness with the war form an important threat to the resistance.

"The village forms the real base of our struggle. It gives it life, manpower, food, support. Without the village, our struggle is lost," Halim said.

Another problem facing the commanders in the field is the lack of money to pay their guerrillas. The parties in Peshawar have been able to provide the insurgents with greater supplies of weapons, but they have not provided substantial quantities of cash.

"We cannot pay the men. Just now and again buy them some sandals or clothes, maybe. But we cannot actually pay them, and this is an enormous problem because again and again I have seen a man come to join our group, be given a weapon, be trained and then, after one or two years, one day he will simply go, return to his home," Halim said.

There usually are good reasons for such a decision. The men return to care for their families and work, which they are unable to do as guerrillas.

For most mujaheddin, an arrangement is made within the tight Afghan family structure to free a man to fight. For example, one brother will work on the land and be present to feed and watch over women relatives, whom they guard jealously from sight, while the other brother goes off to battle.

But the family does not always have the resources to spare a man, and it poses field commanders with the problem of having to train and otherwise deal with a constantly changing group of men.

The inability to pay the guerrillas also lessens the authority of the commander. Every man is a volunteer, and the consequence is generally a lack of discipline. As I witnessed during one night attack in Kabul, an insurgent raid can cause panic and chaos if things do not go right for them.

In addition to economic problems, the insurgents face a new threat from the Afghan internal security service, called Khad. During my first three weeks in Afghanistan, I encountered four cases of informers who had been caught by the mujaheddin.

Western diplomatic sources say that Moscow has given the Khad -- which reportedly is led by the Soviet KGB secret police -- $100 million to expand its intelligence network to infiltrate the resistance both inside Afghanistan and at the parties' headquarters in Peshawar.

In a country where government authority is limited to the major cities and the general situation can be described as anarchic, it presumably was not difficult to arrange for the infiltration under various guises of new informers lured with the monetary aid offered by Moscow.

Some of the informers apparently were sent to make contact with the resistance as defectors, which ordinarily would not be suspicious because more than 60 percent of Army conscripts are estimated to have defected. Other infiltrators seem to have joined the stream of refugees to Pakistan.

The traditionally self-confident and easygoing attitude of Afghans by no means has disappeared as a result of the infiltration, but security at every base has been tightened. Most commanders now admit that the informers are an important threat after scoffing at the danger last year. Forced as they are to depend on the trust and support of the general population, the insurgents may find such infiltration particularly hard to counteract.