Julius K. Nyerere was given farewell honors at a state funeral today by the country he ruled for years with disastrous economic policies but with an inclusiveness that made it a model of harmony on a divided continent.

Nyerere, the Tanzanian leader who died a week ago at age 77 while being treated for leukemia, outlived most of the other "fathers of African independence" who ushered their countries out of colonialism in the 1960s--and in the eyes of many outclassed them all. Only Nelson Mandela, who led South Africa to democracy after a quarter-century in prison, surpassed Nyerere in his reputation for integrity and independence on a continent where the early flush of independence routinely deteriorated into misrule.

Nyerere, who was Tanzania's first president, serving from 1962 to 1985, was known as "Mwalimu." The word means "teacher" in Kiswahili, the language he used to unite the 120 tribes of the former British Trust Territory of Tanganyika on the precept that people were more likely to get along if they could talk to one another.

And today, while large sections of Africa are beset by conflicts that most often fall along ethnic lines--and residents of relatively peaceful nations, such as neighboring Kenya, introduce themselves by tribe or region--Tanzanians almost always identify themselves as Tanzanians.

"We are Tanzanians first," said Emmanuel Masome, 45, at the four-hour service held under a hot sun at the National Stadium with Secretary of State Madeleine K. Albright, Britain's Princess Anne and other dignitaries in attendance.

"He is the man who gave Tanzania unity," agreed Sigsberg Shimbe, 51. "Swahili unified the nation."

That oneness was severely tested by the disastrous economic policies that marred Nyerere's leadership. An ardent socialist, he championed an Africa-specific brand of collectivism known as ujamma, or familyhood. The policy was enforced by a one-party state and culminated in the forced relocation of millions of people into artificial communities. The failed policy cost Tanzania decades of economic progress and left some citizens of two minds about Nyerere.

Sali Slave, 26, offered the usual compliments as he waited near the open Land Rover that would carry away the casket. "Mwalimu is a peaceful ruler," he said. "He is very important for all Tanzanians." Asked about the economy, however, the young man voiced despair. "There is no progress in this country," he said, sticking with the present tense. "The country is screwed up. Nyerere is a dictator."

Nyerere had kept his illness private, and his rapid decline and death at a London hospital left Tanzanians bereft. A month-long period of mourning was declared. After his body was returned from Britain, where it lay in state, it was displayed in a specially built, air-conditioned chamber at a soccer stadium that was kept open for 24 hours.

Even so, the line of mourners extended more than a mile. Ferries from Zanzibar, which joined Tanganyika in 1964 to form Tanzania, carried passengers to the capital free of charge. Nyerere will be buried Saturday in his home village near Lake Victoria.

Nyerere, who stepped down from the presidency, was also honored by long-standing presidents who failed to follow his example, including Robert Mugabe of Zimbabwe and Daniel arap Moi of Kenya. The podium was crowded with delegations from countries whose liberation struggles Tanzania had taken the lead in supporting, notably South Africa and Mozambique. Ethiopian President Meles Zenawi and his Eritrean counterpart, Issaias Afwerki, whose countries are locked in a bloody border war, made a rare public appearance together.

President Yoweri Museveni represented Uganda, the country Tanzanian troops reclaimed from dictator Idi Amin in 1978 then left to Ugandans. President Pierre Buyoya represented Burundi, whose civil war was Nyerere's major preoccupation at the time of his death.

"He labored all his days in fulfillment of the noble and life-giving ideal that people from different cultures and backgrounds can live and work together productively and in peace," said Albright, who is on a six-nation African tour that ends Saturday.

CAPTION: Fadhila Amis and Noel Stephano watch funeral of Julius Nyerere, who served as Tanzania's first president from 1962 to 1985 and died last week at age 77.

CAPTION: Nyerere's funeral attracted representatives of 70 countries, including Secretary of State Madeleine K. Albright.