When Muammar Gaddafi seized power in 1969 he pledged to eliminate tribalism and unite Libya.

But throughout the next 42 years - especially when his popularity wavered - Gaddafi succumbed to the temptation to toy with tribal loyalties and rivalries to tighten his grip.

Now he is dead, Libyans who hope their uprising can bring a modern democracy fret over the role of the myriad tribes which, for many of them, remain important to their personal identity.

Armed bands of tribesmen are among hundreds of militias whose rivalries are undermining interim leaders as they prepare an election; and when it comes to voting, tribal loyalties, paid for by Gaddafi, may help some of his old loyalists get elected.

Yet the weakening of ancient bonds of kinship that has come with city living, and resentments at tribal figures who took Gaddafi's money to advance their own claims to leadership, may mean a diminishing role for the tribes in the new Libya.

Few tribes inspire more questions than the Warfalla, by its own account Libya's biggest. It grabbed headlines last month when fighters in its desert stronghold, Bani Walid, took on a pro-government militia, killed six and threw Tripoli's men out of the city, installing a local council dominated by Warfalla.

Rivals accused the Warfalla of Bani Walid of fighting for a return to the old regime, a charge they emphatically deny.

Tribal loyalties expressed in battle may soon be echoed at the ballot box. At least that is the complaint of those trying to field political parties at an election in June in which, they fear, the rules of the vote may favour individuals who can call on traditional sympathies within their tribe to get elected.

TRIBAL ADVANTAGE

Gaddafi both diffused power in the tribes and used money to create loyalty in the tribes, said Wasila al-Ashriq, who heads an Islamist party call al-Umma that she describes as moderate.

My fear is that people who Gaddafi created as leaders of these tribes will be elected because they have influence, she told Reuters. Some who took on tribal leadership under Gaddafi, she added, owed their prominence to their loyalty to the dictator, rather than to traditional hierarchical codes.

Under the new election law, three seats out of five in the National Assembly are reserved for those who run without party ties as independents. Parties, who are struggling to formulate policies and make themselves known to voters after four decades of one-man rule, can contest only 40 percent of the seats.

Tribal figures still have an advantage over political parties, Ashriq of al-Umma said. Party politics is a new idea in the mind of Libyans. Gaddafi said people who join parties are traitors, and after 40 years some Libyans think this is a direct quote from the Prophet.

Individuals who can boast of local prominence that is not based on tribal allegiance are also expected to do well under the voting system - rivalry among Libya's cities, towns and regions is a powerful factor in the postwar politics.

But across the country, tribes still count.

FADING GLORIES

Yet how much real power tribal leaders wield over ordinary Libyans - and how united the tribes are - is debatable.

Many see tribal affiliation simply as an old boys club, helpful to secure employment and public services - both jobs and welfare in Libya are heavily dependent on the oil-rich state.

Tribal kinship has been on the wane, as in other parts of the world, due to the spread of education and the urbanisation that has separated people from areas where tribes can trace lines of ancestry back into the mists of Libya's history.

Omar al-Majdoub, a Libyan historian, says the days of a tribal Libya are over, especially for the Warfalla, and that the uprising in Bani Walid was a parochial and isolated event.

There is no such thing as a leadership for Warfalla anymore; social and economic conditions have diffused the group away from its geographical centre, he said in an interview.

The Warfalla, he says, is really a loose confederation of around 50 sub-tribes spread across Libya's vast territory and Warfalla tribesmen in Bani Walid might not be aligned in any significant way with members of the same tribe elsewhere in Libya to present a credible threat outside their stronghold.

During last year's civil war, indeed, the Warfalla split.

Bani Walid was one of the last bastions for Gaddafi's fighters - generating some of the suspicions about its current loyalties. But many leading Warfalla figures around the country had defected to the rebels early on in the uprising - including for example Mahmoud Jibril, the wartime rebel prime minister.

NUMBERS GAME

Warfalla numbers, like those of other tribes, are also in dispute. Many of those of Warfalla lineage, who may display their tribal identity in their name as al-Warfalli, prefer their children to seek marriages within the tribe or delight in tales of ancestral valour and honour, will repeat the claim that their tribe boasts a million members - fully one Libyan in six.

But Grira Zargoun Nasser, a professor at Tripoli University and himself born into that tribe, calls that inflated: What people say about Warfalla's size is not true, he said.

The real number is around 400,000, he said, though counting is far from easy, particularly since inter-marriage and a diminishing relevance of tribal identity in the big cities can leave many Libyans less than committed to one tribe or another.

The former regime tried to magnify the perceived importance of this tribe, which he positioned as an ally, Nasser said.

Tribalism was most notably used by Gaddafi in the armed forces, where he ensured each of the handful or so of the biggest tribes shared positions in the security services and military. Aside from the Warfalla, major tribes include the Magarha and the Gaddadfa, Gaddafi's own tribe.

At the same time, Nasser said, he fostered rivalries among the various tribes within the army, as a protection against one group being in a position to overthrow him. In 1993, a group of army officers from the Warfalla attempted a coup and they and their tribal associates suffered bloody reprisals.

The manipulation of old tribal practices by Gaddafi may have prolonged the life of such ideas, compared to their decline in other Arab states, but it may also have helped discredit them. Nasser said he saw the tribes posing no danger to a new Libya.

On the streets of Tripoli, a sprawling Mediterranean port that is home to a third of Libya's people but where local neighbourhoods are still often dominated by one or other tribe, the links between kinship and politics remain topical.

A man called Adil, who sells handicrafts, identifies himself by his tribal family name, al-Warfalli, and is reluctant to discuss how exactly he will vote in June. But he makes clear he will look for guidance to people in traditional positions of trust: Elections are something new to us Libyans. We haven't had this before and we are not educated about it.

Hamza, a 32-year-old shopkeeper who also used his tribal name - al-Marghari - felt strongly, however, that tribalism could be divisive and his chiefs could not count on his support: We should vote for the individual, he said. Not the tribe.

(Editing by Alastair Macdonald)