WINDHOEK, Namibia (AP) _ Sam Nujoma, a high school dropout who fled his country 30 years ago after being arrested for political activity, returned in triumph to become the first president of independent Namibia.

He says he launched a guerrilla war with four guns, but his South-West Africa People's Organization never controlled any territory during the 23-year guerrilla war against South African rule, despite the loss of 20,000 lives.

Nujoma, considered a shrewd, instinctive politician, traveled the world winning support for his cause, and maintained control despite challenges to his leadership.

The 60-year-old former railway steward, who has a full white beard and a perpetual smile, was generally portrayed by South African authorities as a Marxist terrorist while in exile. But since his return home on Sept. 14, even his political opponents have praised Nujoma's moderation and efforts at reconciliation, including agreement on a Western-style democratic Constitution, and the appointment of white businessmen and opposition party members to his Cabinet.

Many Namibians credit Nujoma's leadership for the smooth transition to independence after the deep divisions caused by the war and South Africa's policies of dividing the country into ethnically based regional governments, with separate education and health care for each race.

Nujoma is generally easy-going but can be sensitive about his lack of formal schooling. He is a compelling speaker when he has a prepared text but rambles in disjointed sentences during interviews.

''Others got their education while I led the struggle,'' Nujoma once said. He had been devoted to politics since his 20s, and after being fired from his job as a railway steward for trade union activities, he helped found the Ovamboland People's Organization in the 1950s.

It was based in Ovambo, the most populous, northern part of the territory, and was the forerunner to SWAPO, which has been criticized for filling its leadership posts with members of Nujomo's Ovambo tribe.

He was arrested following a political protest in 1959, and fled the territory shortly after his release. In exile, he helped establish SWAPO and was named president in 1960.

When South Africa refused to head a 1966 U.N. resolution ending its mandate over the former German colony of South-West Africa, Nujoma launched SWAPO's guerrilla campaign. ''We started the armed struggle with only two sub-machine guns and two pistols,'' Nujoma said last year. ''I got them from Algeria, plus some rounds of ammunition.''

SWAPO was never able to claim military victory, but Nujoma won wide political support during his travels to communist and Third World countries. The United Nations declared SWAPO the ''sole and authentic representative of the Namibian people'' although the territory has dozens of political parties.

Critics say Nujoma was able to maintain his grip on power during the years of exile through a ruthless security apparatus that detained, tortured and killed dissidents and suspected spies at SWAPO's camps in Angola. The organization has acknowledged that abuses took place, but said some were justified during time of war.

Nujoma led SWAPO to victory with 57 percent of the vote in November's elections for a constitutional assembly, but the U.N. independence regulations forced the party to compromise with opponents in establishing a form of government which limits Nujoma to two five-year terms as president.