Two American mercenaries imprisoned for seven years and a Washington-area civilian pilot were flying to Paris after their release by Angola today in a complex swap that involved six nations, the Red Cross and a guerrilla organization.

In exchange for the Americans, the anti-Marxist Union for the Total Independence of Angola (UNITA) freed two Soviet airmen, South Africa released a Soviet warrant officer and the bodies of four other Russians, 94 Angolan soldiers, a Cuban soldier and the body of another Cuban, and Angola returned the bodies of three South Africans. The exchange was carried out here under the auspices of the Geneva-based International Committee of the Red Cross.

The Zambian government imposed stringent security at the airport where the swap took place; dozens of soldiers prevented reporters access to the released prisoners. The balcony of the airport terminal was closed, but from about 200 yards away the three Americans, mercenaries Gustavo Grillo and Gary Acker, and civilian pilot Geoffrey Tyler, appeared all right and disembarked without assistance from a twin-engine Red Cross plane that had flown them from Luanda, Angola. A second similar Red Cross plane brought the bodies of the South Africans.

The Americans left aboard a night flight for Paris after waiting in the custody of U.S. Embassy officials until the arrival from South Africa of the Soviet, Cuban and Angolan prisoners and bodies. From Paris, they were to fly to the United States on Wednesday.

The swap had been under negotiation by seven parties -- South Africa, Angola, the Soviet Union, Cuba, Zambia, the United States and UNITA, the anti-Marxist Angolan guerrilla organization -- on three continents for almost two years and had been scheduled to happen several times before today's successful exchange.

Zambia was a key participant because it provided a neutral site as a termination point for a series of Red Cross flights criss-crossing southern Africa, ending more than two years of negotiations over one of the most complicated prisoner exchanges in history.

The successful swap highlighted Zambia's role as an intermediary between black Africa and white-ruled South Africa and, in this case, between East and West.

Grillo, 33, from Jersey City, N.J., and Acker, 27, from Sacramento, Calif., were captured in 1976 while fighting for a losing faction in Angola's civil war. Tyler, 32, a civilian pilot from Prince George's County, crash-landed on a beach 21 months ago while flying a light plane from Abidjan, Ivory Coast, to Cape Town, South Africa.

Soviet officials took custody of the three Russian military men and four bodies when they arrived on a C130 several hours later. Two Soviet airmen had been released yesterday in the Angolan bush by antigovernment rebels and flown to Namibia. The South Africans released the third Russian, warrant officer Nicolai Pestretsov, who was captured in southern Angola 16 months ago.

That plane also contained the 94 Angolans, the Cuban soldier and the Cuban corpse to be returned to Luanda to complete the turnover.

On several occasions earlier dates for the exchange had been set but were abandoned, often at the last minute and usually because UNITA leader Jonas Savimbi balked at terms for releasing the Soviet airmen. Because of the complex logistics, Savimbi had to release his captives first for the swap to proceed.

Aside from the humanitarian gesture by the Angolan parties and South Africa, the various sides were seeking to score political points with the swap.

The release of the mercenaries ends a bitter chapter in relations between Angola and the United States, the only major country that does not recognize the Luanda government. The prisoners have been a long-time impediment to improvement in relations with the oil-rich Marxist West African nation that is a key to the independence of neighboring South Africa-controlled Namibia. The swap also ends the embarrassment of the Soviet Union having its men in Angola in the hands of South Africa and those of a rebel group supported by Pretoria.

Coming just two days before the scheduled visit of Vice President George Bush, the exchange was bound to give a boost to U.S.-Zambian relations.

Zambia asked the recipient governments not to provide close access to the men, and all sides cooperated. The Zambians apparently feared that the released American prisoners might be critical on Zambian soil of Angola, an ally of the Lusaka government.

The prisoners were the product of three separate, but linked, wars in Angola, a country twice the size of Texas on the Atlantic coast of southern Africa that has not experienced peace for almost two decades.

The United States had long sought to have the two mercenaries released from Sao Paulo prison in Luanda.

Prospects for a swap have been unstable ever since guerrillas of the South African-backed UNITA, fighting to gain power in Angola, shot down a Soviet transport plane in southern Angola and captured two crew members two years ago.

The other Soviets and Cubans were captured or killed during South African invasions of Angola in search of guerrillas fighting for independence for neighboring Namibia.

Americans Grillo and Acker were sentenced to 30 and 16 years, respectively, in public trials in 1976 after being convicted of being mercenaries.

Another American, Daniel Gearhart, of Kensington, Md., was executed in July 1976 despite a plea for clemency by president Ford.