Julius Nyerere, 77, Tanzania's first president and an elder statesman who was instrumental in efforts to forge African unity, died Oct. 14 in London, where he was under treatment for leukemia. He also had suffered a stroke.

Mr. Nyerere led the drive for the independence of his East African nation from Britain and in 1962 became the country's first president. Unlike most African leaders who spearheaded the great wave of independence struggles that swept the continent, he was never jailed or persecuted.

A member of the tiny Zanaki tribe, Mr. Nyerere was credited with forging a rare thing in Africa--a strong national identity that united 120 ethnic groups in a country of 32 million.

United Nations Secretary-General Kofi Annan called Mr. Nyerere "one of the giants of the 20th-century African liberation movement."

A founder of the Organization of African Unity in 1963, Mr. Nyerere was a leading proponent of economic sanctions against the former apartheid regime in South Africa.

In 1964, Mr. Nyerere engineered the union of Tanganyika and the Indian Ocean islands of Zanzibar and Pemba to create the United Republic of Tanzania. The next year, he established single-party rule.

The party formally adopted socialism as the country's ideology, but with an African twist: All rural development would be centered on villages. Private banks and many industries also were nationalized.

The socialist state welcomed anyone with an independent or pan-African vision struggling against corrupt and brutal dictatorships in their own countries.

Although Mr. Nyerere's economic program had little success, his social policy is widely revered for having instilled a sense of African identity that cuts across ethnic lines. Under his leadership, Swahili was adopted as the language of all Tanzanians, not individual ethnic dialects or the English left behind by British colonizers. Known affectionately throughout Africa as Mwalimu, or "teacher" in Swahili, Mr. Nyerere stepped down as president in 1985 after 23 years in office to devote his time to farming and diplomacy. He worked tirelessly to negotiate an end to the violence that has wracked Central and Southern Africa in the past decade.

Most recently, Mr. Nyerere tried to mediate an end to the civil war in neighboring Burundi, where more than 200,000 people, mostly civilians, have been killed since 1993.

Long after retirement, Mr. Nyerere conceded that socialism had failed in Tanzania, but he never apologized.

Although he was harsh with his critics and detained some indefinitely without trial, he never acquired notoriety for human rights abuses.

Mr. Nyerere wrote eight books, most of them on development and socialism in Africa and in Tanzania in particular. He also translated William Shakespeare's plays "Julius Caesar" and "The Merchant of Venice" into Swahili.

In 1979, he defied the Organization of African Unity and sent troops to Uganda, claiming it was in retaliation for dictator Idi Amin Dada's deployment of troops to northwestern Tanzania. But Mr. Nyerere's real aim was to rid Africa of Amin. He succeeded.

In a continent known for corrupt leaders who lived lavishly off state coffers, Mr. Nyerere lived modestly. After he retired, parliament hastily passed a law granting him a pension.

He was among only a handful of African presidents to leave office voluntarily. He also foresaw the futility of single-party rule in Tanzania as the clamor for democracy swept the continent after the collapse of communist regimes in Eastern Europe and Russia.

He also had no qualms about discussing Africa's technological and economic backwardness in the 20th century.

"People have gone to the moon and we are still trying to reach the village and the village is getting farther" away, Ali Mazrui, a Kenyan political scientist, quoted Mr. Nyerere as saying.

Mr. Nyerere's home village of Butiama was in western Tanzania near Lake Victoria. He was married and had eight children.