In his heyday as president of Tanzania - which he ruled from 1961 to 1985 - Julius Nyerere, who has died from leukaemia aged 77, was lion- ised by the liberal left of the world for his impassioned advocacy of his style of African socialism, but mauled by his critics as a priggish autocrat, whose idealism failed to deliver prosperity to his people. To his credit, Nyerere stepped down peacefully and voluntarily, long before it became fashionable for Africa's self-appointed life presidents to subject themselves to the verdict of their peoples in multi-party elections.
In 1967 came Nyerere's Arusha Declaration, his policy on socialism and self-reliance. Its cornerstone was ujamaa, or familyhood, which was imposed on Tanzania in the following years. The aim was to collect people into villages or communes, where they would have better access to education and medical services. Nearly 10m peasants were moved and a substantial majority were forced to give up their land. But to most Tanzanians, the idea of collective farming was abhorrent. Many found themselves worse off; incentive and productivity declined, and ujamaa was effectively abandoned. It was a measure of Nyerere's international prestige that the failure of this fundamental policy at home in no way dented his global standing.
A man of austere and unostentatious personal habits, and instantly recognisable in his Mao tunic, Julius Nyerere was born at Butiama, on the eastern shore of Lake Victoria, into the small Zanaki tribe. He was 12 before he first went to school, but was immediately singled out for his lively intelligence by the Roman Catholic priests. After Makerere University, in Kampala, he taught for three years, admitting, later in life, that he was a schoolmaster by choice and a politician by accident.
In 1949 he became the first Tanzanian to study at a British university, when he went to Edinburgh on a government scholarship. And it was there, under the influence of post-war Fabian socialists, that he developed his own political ideas of grafting socialism on to African communal existence.
Nyerere left teaching in 1954, formed the Tanganyika African National Union, and campaigned for the nationalist movement. He was elected to the then Tanganyika legislature in 1958, representing East Province, the first time that the country's Africans were enfranchised, and became leader of the opposition. He became chief minister in 1960. But it was not until 1961, when he was sworn in as prime minister of the newly-independent Tanganyika that he would be in a position to start putting the ideas into practice.
In the same year, he joined other African leaders in denouncing the racist policies of South Africa and declaring that, if the apartheid regime remained in the Commonwealth, Tanzania would never join. South Africa subsequently withdrew its membership.
For Nyerere the move marked the beginning of an effective commitment to African liberation movements: later, he played host to the African National Congress (ANC) and the Pan- African Congress (PAC) of South Africa, to Samora Machel's Frelimo - battling against the Portuguese in Mozambique - and to Robert Mugabe's fledgling Zanla forces, which opposed colonial rule in the then Southern Rhodesia. He broke off relations with Britain, Tanzania's principal aid donor, after its failure to use force when Ian Smith declared UDI in 1965 - earning himself the description by Smith of the "evil genius" behind the ensuing guerrilla war.
The unusually principled way in which Nyerere looked upon international politics was again evident in his uncompromising stand against the brutal regime of Idi Amin in Uganda in the late 1970s. Despite almost universal condemnation of the dictator's excesses, it was left to Tanzania to intervene militarily and dislodge Amin. A brief invasion of Tanzania by Amin in late 1978 brought a swift reponse from Nyerere: Tanzanian troops, joined by Ugandan exiles, were mobilised to drive back the invaders. But they didn't stop at the border. Kampala fell in 1979, with its residents lining the streets chanting the name of the Tanzanian leader. It was the first time in African post-colonial history that one country had invaded another and captured its capital. It was a fundamental breach of the principles of the Organisation of African Unity. But Nyerere weathered the storm.
However, the campaign proved expensive, and while their leader devoted such resources, time and energy to foreign affairs, his critics in Tanzania argued that he overlooked domestic problems, and failed to apply the same observance of human right abuses. He seldom flinched from using a Preventive Detention Act that allowed him to lock up his opponents virtually at will.
Relations with Zanzibar, which had united with Tanganyika in 1964 to form the United Republic of Tanzania with Nyerere as president, were always strained. Tanzania became ever more dependent upon foreign aid, and decision-making was paralysed by a ponderous bureaucracy. Nyerere was to admit that mistakes had been made, while his devotees pointed to developments - such as the spread of literacy and primary healthcare.
A practising Catholic in a predominantly Muslim country, Nyerere married Maria Magige in 1953, by whom he had five sons and two daughters. He maintained a passionate interest in Swahili, the language of East Africa, and translated Julius Caesar and The Merchant Of Venice. His political writings included Essays On Socialism (1969) and Freedom And Development (1973).
The idea that when he resigned as president, handing over to Hassan Ali Mwinyi, Nyerere would live quietly on his farm at Batiama, cultivating his interest in book-binding, was always improbable. And indeed he continued to influence government policy through his chairmanship of the single ruling party, Chama Cha Mapinduzi.
Whether or not he initiated the debate about an alternative political system in Tanzania is questionable, but he rapidly became a part of it. Although mwalimu , or teacher, as he liked to be known, was to his own people one of them, he nonetheless became - like Senghor, of Senegal, and Sadat, of Egypt - an African leader who outgrew his country.
When he relinquished the party chairmanship in 1990, he was able to devote more time to campaigning for greater co-operation between developing countries, and, as chairman of the South Commission, a closing of the gap between rich and poor. He also took on the role of African elder statesman, working notably in conflict resolution, although his most recent efforts - trying to resolve Burundi's civil war - did not bear fruit.
Julius Nyerere belonged to a generation of African post-independence leaders, like Ghana's Kwame Nkrumah and Zambia's Kenneth Kaunda, who had an unshakeable belief in their mission to lead their countries to a better world through their chosen political ideologies, but who were unable to recognise their personal failings.
When he stepped down, Nyerere declared that "although socialism has failed in Tanzania, I will remain a socialist because I believe socialism is the best policy for poor countries like Tanzania". His suc cessors decided otherwise, embracing capitalism and the free market, but with arguable benefits to the country.
His detractors would regard his stewardship of Tanzania to have been flawed by his single-minded adherence to a manifestly unworkable policy. Yet Nyerere is more likely to be remembered for having provided a moral leadership to Tanzania, and indeed Africa, when the continent was taking its first shaky steps after independence.
Ahmed Rajab, editor of Africa Analysis, writes: Julius Nyerere was "a great leader who made great mistakes," as one ruler once famously said of another. He unified his country, certainly, gave it a sense of purpose and, in the 1960s and 1970s, made Tanzanians feel proud of themselves.
As a pan-Africanist, he could not be faulted for putting his country in the forefront of the frontline states against white minority rule in Africa. He took a principled stand at a great cost to his country, but his people never really minded. Tanzania became a home for exiled freedom-fighters who are now the rulers in a number of southern African states.
Many a time, Nyerere confounded those of us who thought of ourselves as being to his left by appropriating our political lexicon and social agenda. He never quite became a Marxist, but the former shepherd boy, whom we used to deride as "a good boy of the west" and who was viewed with suspicion by the likes of Kwame Nkrumah, turned into a tactical ally when he started talking about class struggle and a classless society.
But his African socialist philosophy of ujamaa only brought misery and economic degradation. Under the man who preached self-reliance, Tanzania depended on foreign aid more than any other African country. That was only one of his contradictions.
His vision of a united Africa did not stop him from recognising Biafra, the breakaway eastern Nigeria, in the early 1960s. A pious Catholic, who could not tolerate the excesses of Idi Amin, Nyerere nonetheless felt himself unable to move against another dictator much closer to home: the burly Sheikh Abeid Karume, Zanzibar's then president and Tanzania's first vice-president, who presided over a brutal dictatorship, detained people without trial, killed countless imagined or real enemies, and forced girls of Persian or Arab origin to marry elderly black Zanzibaris.
Karume was assassinated in 1972 but, throughout the sheikh's eight-year rule, Nyerere never lifted a finger against his tragic histrionics.
Despite his failings, Nyerere was revered by progressive Africans. When they talked of Tanzania, they talked, in effect, of Nyerere - the simple, unassuming former schoolteacher, untainted by corruption or personal scandals and with a fondness for Mateus rosé. In the 1950s and 1960s, admirers would copy his hairstyle, his moustache, and later, when he started donning a kofia , the Swahili-Muslim cap, his fellow up-country Christians did likewise. In the mid-1960s he went to China, shook hands with Chairman Mao, and came back with a variant of the Mao suit, which became de rigueur among Tanzania's officials and aspiring politicians.
H ad he not been a politician, Nyerere might have become a scholar of repute. He was a poet of modest pretensions and, although his translation of Julius Caesar was not brilliant, he did, after all, dare to translate Shakespeare. He could be profound and esoteric to the intellectuals; streetwise to the masses. His speeches were electrifying.
I remember spending the best part of two hours with him alone in a Nairobi hotel room in 1994, when he was out of office and Tanzania was about to embark on its first multi-party elections. Initially, he refused to discuss the prospective presidential candidates of his own party, the Chama Cha Mapinduzi. But once he had been assured that it was strictly off-the-record, he became candid, almost gossipy, about a number of party leaders.
Earlier in the day, when I offered to bring him tea during a conference break, he turned me down, saying: "Let me do it myself; it is at times like these that I can act as a normal human being."
Julius Kambarage Nyerere, politician, born 1922; died October 14 1999