If a 51-year-old American incarcerated in the Afghan capital, Kabul, was to be tried and convicted under Islamic law, he could face either of two punishments - have a wall demolished over him or be flung from the top of the tallest building in town. His alleged crime: sodomy. But fortunately for Vins White, when his case comes up for trial in Afghanistan's barely functioning judicial system, it will almost certainly be under a new, secular criminal procedure code. Unlike the ousted Taleban regime, the transitional administration of President Hamid Karzai would not risk world opprobrium by letting judges award punishments under ancient religious statutes that violate fundamental human rights. But as Afghanistan begins the daunting task of reconstructing, virtually from scratch, a judicial system devastated by 22 years of war, the case of Mr White, who was employed as a financial adviser to the government until his dramatic arrest at a Kabul hotel last month, highlights the challenges and pitfalls that lie ahead. Even under the interim criminal code adopted in February, homosexuality remains an offence punishable by up to 16 years' imprisonment. But most judges are schooled in Islamic law, and the provisional constitution does not make it clear which law - secular or religious - has precedence. To add to the legal hodgepodge, in vast tracts of the country away from major cities, people still practise customary tribal law that is primitive though not retributive - a murderer can be pardoned, for instance, if his family offers a virgin girl to the victim's relatives. 'In most areas, there are no police and no courts, since the authority of the central government doesn't extend very far,' said Mary McGowan Davis, a retired New York judge helping train defence lawyers in Kabul. 'As a result, many communities rely on local tradition for justice.' But the situation today even in the national capital is far from satisfactory. There is a dearth of qualified judges, a severe shortage of criminal defence lawyers, most court records and statute books are missing, and there isn't money to pay for the judges' regal uniforms - flowing red-and-black robes with velvet, three-cornered hats. Nevertheless, legal experts regard the new criminal law as the first significant step towards rebuilding and modernising the country's judicial system. 'There are many fine provisions in the new law, such as the right to a defence attorney and limits to the duration of custody,' said Karim Khurram, country chief of Legal Aid Afghanistan, which employs seven defence lawyers. The youngest, Din Mohammed Gran, schooled in Islamic law, is aged 60, epitomising how a whole generation of legal personnel is missing in Afghanistan due to war, communist rule and the lawless Taleban regime. Kabul, a city of about four million, has just 60 criminal defence lawyers, two-thirds of whom are employed by the barely active legal aid department of the Supreme Court, which is presided over by an Islamic scholar. But Kabul University's law faculty, offering courses both in Islamic and secular law, is active once again and has even enrolled a few women students. 'Nowadays, there may be new laws but it will take time before the police, judges and lawyers learn to implement them properly,' said Mr Gran. 'We need at least five years to repair the system.' The trial this month of three Americans accused of torturing Afghans at a private interrogation centre in the capital showed how the system remains seriously flawed. The judge rushed through the proceedings, did not permit witnesses to be cross-examined, accepted the prosecution story even where there was contradictory evidence, and handed out long jail sentences. The obvious conclusion: in politically sensitive cases, judges can be influenced by extraneous factors, including pressure from powerful people. Several US citizens are known to be imprisoned in Afghanistan. 'We are aware of a number of American prisoners currently being held in Afghanistan jails,' said a spokesperson for the US Embassy. 'However, due to privacy concerns, we are unable to furnish more details about them or their cases.' Despite the trauma of those facing trial, the curtain is finally coming down on the dark ages of Afghanistan's judicial system. Afghan jurisprudence has been a mixture of Islamic and modern law for more than a century. Path-breaking secular codes for criminal, civil and commercial law were formally promulgated by the then ruling monarchy in the early 1920s. Despite occasional setbacks, legal reforms continued apace until the communist putsch in April, 1978, and the Soviet occupation the following year. Although the communists continued with reforms in some spheres - such as according equal rights for women - they added a new, terrifying dimension to the judicial system: the 'revolutionary courts'. Tens of thousands of Afghans were jailed or executed for so-called 'political crimes'. 'For the first time, there were more political prisoners than criminals in Afghan jails,' said Mr Khurram. 'You could be locked up for not shouting 'Hurrah!' in response to communist sloganeering.' The collapse of the judicial system was complete under the over-zealous 'mujahedeen' (the 'holy fighters' who unseated the communists) and the fanatical Taleban who followed. Many judges, lawyers and law students went into exile, statute books and court records were destroyed, and extreme Islamic punishments - such as amputation of the hand for theft or stoning to death for adultery - became the norm. Ideology is no longer the enemy of justice and humanity in the Afghan legal system. But nearly three years after US-led military forces routed the Taleban, the failure to disarm warlords, develop an effective national police force, and expand and strengthen the courts has made justice scarce, especially in the provinces. Now both private and government initiatives seek to redress the balance and guarantee justice to the Afghans. Legal Aid Afghanistan, for instance, plans to open offices in three provincial cities in the coming year and double its number of defence lawyers. Judges are also being prodded into adopting a more humane approach. An impoverished opium addict caught stealing a bottle of cooking oil, for instance, was spared imprisonment and ordered instead to undergo drug rehabilitation. Under the Taleban, his hand would have been chopped off. Two teenagers convicted of pre-marital sex were also punished humanely by Afghan standards - the boy got five years in prison, the girl's sentence was commuted and she was pardoned. In the past, both would have been brutally whipped in public. 'It's going to be a long, hard slog,' said Mr Gran. 'But people will gradually become aware that there is rule of law in Afghanistan, that the time of the gun is over.'