A Lufthansa pilot, cruising high over southern Europe on a routine flight last week, suddenly heard a grim message crackle into his earphones from the captain of another Lufthansa flight over the Mediterranean. Flight 181 - from the Spanish resort island of Mallorca to Frankfort - was being hijacked. "Please relay."

Forty minutes later, a four-line German press agency bulletin flashed across teletypes in the offices of West German Chancellor Helmut Schmidt, who reportedly saw at once that the biggest challenge of his career had begun.

Six top Cabinet ministers and trusted aides were quickly called in for what became the first of the "small crisis staff" meetings. But nobody knew much more than that 82 passengers, mostly returning German vacationers, were aboard with a crew of five.

By nightfall, however, Schmidt's fears were confirmed. Forced down at Rome for a refueling stop, the leader of four Arabic-speaking hijackers made it clear in broken English that the price for getting the hostages back alive was freedom for 13 jailed terrorists. 11 of them among the most notorious in West German jails, plus two Palestinians in Turkish jails.

The demands - in the midst of a wave of murders, kidnapings and attacks by extreme left-wing anarchists of the Red Army Faction - stunned West Germany.

Six weeks ago. German terrorists had kidnapped industrialist Hanns - Martin Schleyer, making the initial demand for the release of their jailed comrades. Schmidt had managed to stall the kidnapers without a false move. But now the hijacking byother terrorists working in league with the German guerillas has dealt a vastly stronger hand to the home-grown extremists.

The hijacking also mortified West German security experts, who had ringed airports in this country with police throughout the Schleyer stand off. The hijackers simply boarded at Malloreat through notoriously lax Spanish airport controls.

Fifty -five minutes after takeoff, two women hijackers reached into their boots, withdrew guns and hand grenades, and with two male accomplices, took command of the flight.

Six days, six countries and 6,000 flying miles later, the hijacking ended in success for West Germany. A daring night raid in Somalia by superbly trained West German commandos rescued all on board unharmed. Three of the four terrorist were shot dead and the fourth was critically wounded.

What had begun on Oct 13 as an unforgivable security lapse at Mallorca ended as a blow against terrorism of potentially great international importance, and a badly needed shot in the arm for Schmidt and West Germany.

The outcome, as a top Schmidt aide readily acknowledges, "had a high degree of luck."

The events and decisions surrounding the odyssey of Flight 181 are being mulled over in many capitals. The episode, lucky or not, suggests that other governments than just Israel have a chance of avoiding blackmail by fanatical hijackers.

In Bonn that first night, while the hijcakers were flying toward Cyprus, and during the following day, with the craft in Bahrain on the Persian Gulf, several crucial decisions were made.

Schmidt called in leaders of opposition parties and formed what is called the "large crisis staff." It established the principle that all major decisions would be taken unanimously.

Schmidt's left-center coalition had been under fire all year, from conservatives who argued that it was too soft on fighting terrism, and from left-wingers who argued that civil liberties were being crushed in the battle being waged.

The idea of unanimity, as Schmidt saw it, was vital both to effective negotiations with the hijackers and to the avoidance of a wrenching political fight that could have polarized the nation in the event of failure.

A news blackout on government moves, in effect since the Schleyer kidnaping, was extended to the hijack.

Next, the political leaders decided that the government would not yield to the hijackers' demands of freedom for the jailed leaders of the Baader Meinhof gang that had spread urban violence and fear of a new anarchy through German cities in the late 1960s and early 1970s.

In early 1975, when Berlin Christian Democratic party leader Peter Lorenz was kidnaped by terrorist, Bonn gave in and freed five jailed guerillas to get him back. The prisoners were flown to Aden and within a year were back in West Germany's terrorist underground. It was Schmidt's first such test as chancellor.

A few months later, terrorists took over the West German embassy in Stockholm and demanded that more prisoners be freed. Schmidt refused, setting a new policy that now faced a far more severe test.

On the day the Lufthansa 737 was hijacked, a little-known commando unit began practicing assaults on a similar airliner in a hanger at Cologne airport. No decision had been made to try to use force to free the hostages, but two squads of 32 men each boarded a special jet and headed for Cyprus that night.

Scmidt's chief troubleshooter, Arab specialist and negotiator, Hans Juergen Wischnewski - carrying satchels with millions of deutschemarks - set off in another jet, trailing the hijacked airliner around, hoping to begin negotiations.

"You can't rescue people from an airliner that keeps moving around." said one top advisor "So the first step is to get past the first ultimatum. Then, if you should be able to be on speaking terms with the hijackers and you can decide if you have a chance to use force."

The first ultimatum, to free the prisoners and pay a $15 million ransom or have the plane blown up, came last Sunday while the plane was in Dubai, a tiny state on the east coast of the Arabian peninsula.

But funny thing happened on the way to Dubai. The government of Lebanon, Syria and Iraq refused permission for the hijackers to land at their airports, and even Bahrain and Dubai tried to prevent the landings.

Vietnam, Somalia and South Yemen, which the hijackers named to receive released prisoners said the didn't want them. The circle of countries that in the past had provided haven, reluctantly in many cases, for fugitive terrorists seemed to be shrinking.

During the weekend, the Bonn government, whose spokesman had let it slip that a plane carrying anti-terrorist units had gone to Cyprus and then to Turkey, made a show of announcing the return of that plane to Cologne.

But there were now two planes, and the second one was following around the tireless Wischnewski "to be used if the opportunity arose."

Schmidt made calls to British Prime Minister James Callaghan. French President Giscard d'Estaing and U.S. President Jimmy Carter, and to leaders of countries on the plane's route. These were mant to develop a consensus of support for a German government that, understandably, is more concerned over its image than most countries.

"It's easire to cope with this problem - including the prospect of failure - if you can be confident of support and understanding in other countries, both in a technical and moral way."said a top Schmidt adviser.

"It would have been impossible if Giscard or Callaghan didn't agree with our course. Our international reputation would have been damaged. There could have been diplomatic turmoil for months amd we simply cannot put our interests into the hands of terrorists who want nothing more than paint us as a police state. so we had to make sure things were done in the right way. We were not asking anyone to share the political responsibility but rather to get their advice and acceptance morally."

In Dubai that Sunday, Wischnewski was on the ground and talking for the first time with the agitated hijackers by radio. They let the important first deadline go by and set a new one for later in the day.

Perhaps fearing a surprise, the hijackers ordered the plane into the air 40 minutes before the new deadline.

They headed for Oman, but the sultan refused permission to land and they went to Aden, where South Yemen authorities also tried to keep them from landing.

The pilot , Juergen Schumann, 37, made a rough landing in a firt strip alongside the main runway. It was his last landing.

Schumann left the plane to inspect for damage and wandered into an area cordoned off by South Yemeni security forces, apparently trying to convince them they should not allow the plane to take off again. When he got back to the cabin, he knelt in the aisle while a one-question "trial" was held by the hijackers on whether he had fried to escape. He was executed pm the - spot shot through the head in front of all the passengers, including seven young children.

The killings spread overwhelming fear and loss of hope among the passengers, who had been forced to sit strapped into their seats for four days in a stifling cabin and now had to contemplate the pilot's body lying for hours in the center aisle.

News of the killing sent a wave of revulsion through West Germany and gave the government even more public support not to yield.

Ten hours after landing in Aden, the plane, with the co-pilot at the controls, headed for what would be its sixth contry and last stop - Mogadishu, Somalia, last Monday.

Wischnewski, who had been refused permission to land in Aden had to bide his time in Saudi Arabia, was now in Somalia, too, and in contact with his commando team which was new on the Greek island of Crele, some five flying hours away.

Tension was extremely high after the pilot's murder, both in Bonn and on the plane. A late afternoon deadline had been set by the hijackers who were tying people up, pouring alcohol from passengers' gift-shop liquor over the hostages and in the cabin for eventual burning and collecting passports to throw out so that passengers could be identified after the explosion.

Then Wischewski lied. He led the hijackers to believe, informed sources say that the Baader Meinhof prisoners had been released and were enroute to Somalia. The ruse worked and a new deadline, ten hours later, was set.

Most important, the deadline was in the middle of the night. Darkness was essential. The commandos had set off before the Somali government actually gave permission for the rescue assault.

The West German, British, Americans and Saudi Arabians played all their chips to pressure Somalia to go along. It worked.

A West Germans foreign aid program involving advisory help to the Somalia police force - which created considerable controversy in the bonn Parliament several years ago - came in handy in gaining the approval.

Most important. However, Wischnewski says was that three times the hijackers harshly rejected Somali offers of safe conduct in return for freeing the hostages.

When the commandos arrived, they brought with them more signs of the international cooperation that has made counter-attacks against terrorists more plausible.

They carried specially designed British grenades capable of stunning people with blinding light and deafening sound into several seconds of inaction. And they brought two special British advisers in case there were any questions.

The 23 commandos picked for the actual assault were part of a 170 man unit formed after the 1972 massacre of Israeli athletes by Palestinian terrorist at the Munich Olympic. West German police, basically untrained for dealing with such situation at the time, had bungled that rescue attempt.

The West Germany force is much like special Israeli units or American special forces. Their leader, Lt. Col. Ulrich Wegener, had received Israeli training. He spent enough time in an American prisoner of war camp at the end of World War II to learn English perfectly.

Wegener's finely tuned unit, however, had never fired a shot in anger until an hour before the final dead line was due to expire in the early morning hours of Tuesday.

His men, their faces blackened crept beneath the darkened jetliner from behind, rolled out a burning oil drum as a diversion, climb up lad ders, snapped open the passenger doors, hurled the grenades and gunned down the hijackers.

It was over in seven minutes and when the unit came back to Cologne for a heroes' welcome the following day, they were wearing jeans and sport clothes.

They looked more like a returning soccer team and that is what Bonn wanted for what was, in effect, this country's first military operation out side its own borders since World War II.