KUWAIT -- Part of the puzzle behind the seizure of Western hostages in Lebanon has been the close relationship between Imad Mugniyeh, reputedly the mastermind of the kidnappings, and a man under sentence of death in this Persian Gulf emirate.

The condemned prisoner, Mustafa Youssef Badreddin, is related to Mugniyeh by marriage -- his sister is Mugniyeh's wife. But the deepest tie binding the two Lebanese-born Shiite Moslems is thought to be a comradeship forged in their secret, deadly missions of terrorism.

The Mugniyeh connection is important in the larger hostage puzzle, analysts say, partly because he may not be entirely under the control of Iran, which is believed to have great influence with Lebanese Shiite extremist groups. Even if the Iranians pressured him to release the remaining six American hostages -- at least two of whom are thought to be under Mugniyeh's direct control -- he might resist without some guarantee on the release of Badreddin.

Mugniyeh and Badreddin were part of the Iranian-backed terrorism network in Lebanon, according to U.S., Israeli and Lebanese sources, but analysts are not sure whether they were directly involved in the 1983 bombings of the U.S. and French marine barracks and the U.S. Embassy that left more than 350 dead.

Analysts say, however, that there is little doubt Mugniyeh and Badreddin helped plan December 1983 bombings in Kuwait against the U.S. and French embassies there that killed five people and injured more than 80.

"Badreddin was the bomb-master, and Mugniyeh, apparently, the organizer," according to Martin Kramer, a Tel Aviv University specialist on Lebanon. He suspects this partnership may have begun with the 1983 bombings against U.S. and French facilities in Lebanon, but he said he has not seen hard evidence to confirm this role.

This partnership ended abruptly, however, when Badreddin was arrested here after the Kuwait bombings. Mugniyeh has been trying ever since to get his friend and brother-in-law out of prison, using the tactic of hostage-taking, analysts said.

Mugniyeh orchestrated a wave of kidnappings of Americans in Lebanon -- including CIA station chief William Buckley, Associated Press journalist Terry Anderson and others -- that started in early 1984, not long after the Kuwait bombers were arrested, Kramer said. U.S. officials also hold Mugniyeh partly responsible for the 1985 hijacking of TWA Flight 847, in which a U.S. seaman was slain. He operated under the cover of a shadowy organization known as Islamic Jihad, which most analysts say is little more than an alias for the Mugniyeh clan and its allies.

Through it all, Mugniyeh has tenaciously held to one basic demand -- freedom for Badreddin and 14 others convicted of the bombings in exchange for release of the Western hostages.

At first, Mugniyeh did not publicize his demand that the 15 be released in exchange for the hostages. "He wanted to do a secret deal," Kramer said. The link was first made in May 1985, in a statement by Islamic Jihad to a Beirut newspaper. Ten days later, an Iraqi Shiite attempted to assassinate Kuwait's emir.

Kuwait, despite subtle pressure from the U.S., French and West German governments, reportedly has refused even to discuss swapping the 15 for hostages. Kuwaiti officials have argued that convicted saboteurs should not be equated with innocent hostages. They also want to show a hard line against terrorism since Kuwait was the target of numerous Iranian-supported terrorist actions during the Iran-Iraq war.

But the Mideast's shifting alliances often open doors that once seemed permanently closed. Kuwait's recent warming of relations with Iran has prompted speculation here that it might now be willing to consider a compromise on the fate of Badreddin and the other prisoners.

According to unconfirmed reports here, Iranian Foreign Minister Ali Akbar Velayati, whose country has funded Mugniyeh's and Badreddin's past activities, raised the issue of the 15 prisoners with Kuwaiti officials during a recent visit here, reportedly to see if Kuwait would show flexibility.

Such flexibility might be possible now, some observers argue, since Kuwait's new detente with Iran holds the promise of greater domestic security. The wartime Iranian subversion, according to a Kuwaiti official who asked not to be named, now seems over.

"I think the main purpose of {Velayati's} visit was to assure us that the past has gone. It shows they have goodwill and want mutual cooperation," he said.

The Kuwaiti official denied, however, that Velayati raised the matter of the 15 prisoners and insisted that his government's position on them had not changed.

Kuwait's ruler, Sheik Jabir Ahmed Sabah, has declined to carry out the death sentences imposed on Badreddin and two others, apparently in the belief the executions could set off a new wave of terrorism against Kuwait, according to a Kuwaiti familiar with his views.

He also has permitted the prisoners' families to come from Lebanon to visit them in prison. Twelve of the 15 are Iraqis and are believed to be members of the fundamentalist Shiite Dawa Islamiya movement. The other three, including Badreddin, are Lebanese. Two others in the original group were released after completing five-year sentences for their roles in the 1983 bombings.

Kramer said that short of releasing the prisoners, there are steps Kuwait could take "such as commuting the death sentences and cutting into" some of the longer sentences, which range from 10 years to life.

A mysterious figure, Mugniyeh is believed to be in his 30s and is thought to come from the southern Lebanese village of Tir Dibba. By the early 1980s, while in Beirut, he reportedly had been recruited by Force 17, the special security apparatus of the mainstream Fatah faction of the Palestine Liberation Organization.

Mugniyeh was trained in a Fatah camp near Beirut airport, according to a Lebanese source who visited it in 1981. This source speculated that Mugniyeh -- and perhaps Badreddin -- learned from Fatah bomb makers the technique of encasing explosives in household cooking-gas canisters, thereby enhancing the destructiveness of the blast. This technique was later used to deadly effect in the 1983 bombings of the U.S. Embassy and Marine barracks in Lebanon.

"He had a lot of ability and rose quickly," Kramer said of Mugniyeh. But when the PLO was forced out of Lebanon after the 1982 Israeli invasion, Mugniyeh was out of a job. He linked up with Iranian Revolutionary Guards in Lebanon and became part of the loose, Iranian-supported Shiite organization Hezbollah.

"After the PLO left, he was for hire," said one Lebanese source who knew Mugniyeh during the early 1980s. "That was how the Iranians used him."