A Ugandan airliner with about 40 passengers aboard was hijacked today and flown to a town in war-ravaged southwestern Uganda, a region that in recent months has been sealed off from the rest of the country by a rebel army.

The airliner was hijacked this morning about half an hour after it took off from Entebbe Airport, near the Ugandan capital of Kampala, on an internal flight to the northern town of Arua. The pilot radioed air traffic controllers to say a gunman had ordered him to turn west. That was the last radio contact with the airplane.

The Uganda Airlines plane landed later at Kasese, a town about 200 miles west of Kampala. Late tonight, all passengers were reported safe.

Kasese is one of the major strongholds of the National Resistance Army, which has been waging a bloody civil war since the July 27 coup that toppled the government of President Milton Obote. The rebel army fought the Obote government for nearly five years, and it has continued fighting against the military leaders that replaced him.

In the process, the East African country has been reduced to a state of near-anarchy, with almost daily reports of shooting, raping and looting by ill-disciplined soldiers.

A man claiming to represent the National Resistance Army telephoned the British Broadcasting Corp. offices in Nairobi and said the plane was seized by rebels because Uganda Airlines was "used to ferry military personnel to Arua."

A spokesman for the rebel army in Nairobi said tonight that he had no knowledge that the hijacker was authorized by his organization.

The Ugandan minister for internal affairs, Paul Ssemogerere, tonight told the BBC that the rebels' complicity in the hijacking could only have a negative effect on peace talks with the government, but he added that the talks will continue.

Two members of Uganda's ruling Military Council, which was set up in August by coup leader Gen. Tito Okello, were supposed to have been aboard the hijacked plane, but Isaac Lumago and Amin Onzi reportedly canceled their trip at the last minute for unknown reasons.

[West German Ambassador Guenther Held said four West Germans, two doctors and two nurses on their way to work at the Arua hospital, were aboard the plane, United Press International reported. It was not known whether any other foreigners were on the plane.]

The hijacked plane is a twin-engine, turboprop Fokker Friendship aircraft that seats 40 passengers. Although the precise number and identity of passengers aboard the plane was not available, airport officials at Entebbe said the flight to Arua is usually sold out and filled with Ugandan citizens. As a result of the years of fighting in Uganda, many major roads have become impassable, and air travel, for many, is the only remaining means of transportation.

Sporadic peace talks between the National Resistance Army and the Ugandan government have been going on in Nairobi since late August under the auspices of Kenyan President Daniel arap Moi.

The main sticking point in the talks has been the demand by rebel army leader Yoweri Museveni that his forces be given control over the Ugandan Army and that half the seats on the ruling Military Council be given to the National Resistance Army.

Here in Nairobi, negotiators for the Ugandan government have balked at these demands, while in Uganda itself the Army has been slowly losing ground to guerrilla incursions.

Last week the chief of Uganda's Army, Lt. Gen. Basilio Okello, acknowledged that his soldiers are finding the war "very difficult to win" because they are engaged constantly in stealing, armed robbery and looting. Rebel soldiers are considered to be far more disciplined than those of the Ugandan Army.

Okello said Army harassment of civilians was forcing Ugandans to cooperate with the rebel "enemy" instead of with their own government.

The Citizen, a newspaper in Kampala, reported that in the past two weeks in an area east of the capital, Army soldiers killed at least 50 civilians.

Last week, rebel leader Museveni announced that he was setting up an "interim administration" to govern the south and southwestern sections of the country he controls.

As civil war has plundered much of Uganda, one of Africa's most fertile nations and once one of its most developed, shortages of food, fuel and medicine have become acute.

An emergency airlift of medicines was begun last week under the auspices of the United Nations Childrens Fund to move drugs into rebel-controlled regions that have been cut off from outside supplies for more than three months.