ALGIERS, Algeria (AP) _ Algeria, which has played a key role in mediating hostage crises for more than a decade, achieved another success Wednesday with the peaceful conclusion to the hijacking of a Kuwait Airways jumbo jet.

Some evidence indicates that the outlines of the deal that led to freedom for 31 hostages may have been worked out in Cyprus more than a week ago.

Neither Algeria nor the gunmen, who separately announced the end of the 16- day crisis, provided any details on what led to the end of the hijacking.

The hijackers were whisked away and were believed to have been taken to Iran or Lebanon.

Interior Minister Hedi Khediri, asked about the fate of the hijackers, replied, ''That is strictly Algeria's affair.''

The hijackers had demanded that Kuwait release 17 terrorists jailed for the 1983 bombings of U.S. and French embassies in Kuwait. Kuwait steadfastly refused, and the Kuwait News Agency said the only deal made with the hijackers was safe passage out of Algeria.

Algeria was criticized for striking deals in the 1970s. The world media dubbed the North African nation a ''sanctuary for hijackers,'' and for a while the country adopted a policy of not accepting hijacked planes.

But in 1981, Algeria gained international prestige for meticulously mediating the release of the American hostages held in the U.S. Embassy in Iran.

Algeria also was involved in the negotiations that led to the end of the 1985 hijacking of a TWA jetliner with 145 people aboard. The hijackers had killed a U.S. Navy diver.

The non-aligned nation is a strong believer in secret negotiations and in mediations adheres to another country's wishes to the letter.

Khediri declined to give any information about the intensive backstage bargaining in which the hijackers bought the safe passage from Algeria that may be the only achievement of their dramatic and bloody attack.

Before the plane landed in Algiers from Larnaca April 13, Cypriot government officials told reporters the Boeing was allowed to take off only because Algeria had given formal assurance that all the hostages would be released. The hijackers had killed two passengers in Larnaca.

Algeria promptly denied that claim, apparently to avoid arousing the suspicion of the hijackers in the delicate maneuvering that followed at Algiers airport.

Aided by the revolutionary credentials it gained in its bitter eight-year war of independence with France, Algeria is well placed among Moslem countries in mediating between moderate governments and fundamentalist Islamic extremists.

In this case, they set up a top-level negotiating committee, personally supervised by Khediri and divided into two teams, one for contacts with the Kuwaitis and the other for liason with the gunmen.

Algerian officials shuttled seemingly unperturbed between the two sides.

Khediri himself was the first Algerian to board the plane on April 13. After talking to them for 30 minutes, he announced they had promised to ''refrain from all violence while on Algerian territory.''

Various Algerian negotiators went to and from the plane day and night for six days. Several times, hooded hijackers climbed down from the plane to talk to Algerian negotiators in a Soviet-built yellow Niva hatchback car.

When the hijackers had something new to say, they would call on the jet's radio, ''Yellow car, please.''

When the Algerians wanted to talk to the hijackers or send them a message, they would ask, ''Can the yellow car come to the plane, please?''

Extreme politeness was observed in all these exchanges. There was never any discussion of substantive issues since conversations with the control tower were monitored by reporters. The yellow car was the critical negotiating vehicle.

When the hostages finally emerged from the plane at 6 a.m., the hijackers were gone.