Last night's U.S. attack on Libya followed a flurry of diplomatic activity including a last-minute message to the Soviet Union that the attack was under way and earlier, only partially successful consultations with the West European allies.

As the attack began, Soviet acting ambassador Oleg M. Sokolov was called to the State Department to be told what evidence of Libyan terrorism was in the hands of the United States, why the attack was taking place, and that the action was "in no way directed against the Soviet Union," Secretary of State George P. Shultz said last night.

Early today, the Soviet news agency Tass called the U.S. attack "naked aggression" and an example of "state terrorism." Tass added that it was too soon "to speak of the consequences" of the U.S. raid.

Yesterday in Moscow, Marshal Sergei Akhromeyev, chief of staff of the Soviet armed forces, told a news conference that "Soviet lives are at risk in Libya." First Deputy Foreign Minister Georgi Kornienko told the same news conference that "in the event of American strikes, then of course they [Soviet personnel] will come under attack, along with the Libyans. Their lives are in danger -- and of course we are worried."

In attacking Libya, the United States was taking military action against a nation that has close military relations with the Soviet Union and as many as 6,000 Soviet advisers on its soil. However, Soviet spokesmen in recent days have distanced themselves somewhat from Libyan leader Muammar Qaddafi. The Soviets recently stationed warships off Libya, but reportedly withdrew them before the U.S. attack.

U.S. efforts to win support for military action from its European allies met limited success. Britain endorsed the American move and gave permission for the use of U.S. F111 fighter-bombers based in Britain to join the raid against Libya. But Defense Secretary Caspar W. Weinberger revealed last night that the French government denied permission for those planes to fly over French territory, which required them to take a circuitous, 2,800-mile route to Libya around the Iberian peninsula.

In The Hague, where foreign ministers of the 12 European Community nations met yesterday to consider joint action on Libya, a spokesman for the Dutch government said the ministers had no warning that Washington would take military action last night. The Europeans did agree to reduce and restrict Libyan diplomatic missions in their countries, but also expressed the hope that military action could be avoided.

There was no immediate reaction to the raid last night from other Arab nations, including important allies of the United States. In earlier public statements, Arab countries had expressed solidarity with Libya, though many are known to harbor ambivalent feelings about Qaddafi.

After U.S. intelligence learned late in March of Libyan plans to attack U.S. targets in West Berlin, diplomatic contacts were made with both the Soviet and East German governments in an effort to obtain their cooperation in cracking down on the Libyan People's Bureau, or embassy, in East Berlin, according to U.S. sources. Discussions about Libyan terrorism were held with departing Soviet Ambassador Anatoliy Dobrynin in Washington last week, officials said.

French, German and Italian authorities are all reported to have worked in close cooperation with the United States to thwart Libyan-supported terrorism in those countries, and France and Germany expelled Libyan diplomats recently on terrorism charges. On the other hand, those three governments were unwilling to give public support to U.S. military attacks on Libya.

The Atlantic Alliance would be placed under unusual strain if Libyan-backed terrorism continues or grows in Western Europe in days ahead. European diplomats have made the point that the Libya's war of terrorism against the United States has been played out mostly on European territory. President Reagan in his televised address and Shultz in a subsequent news conference made special appeals for European support. "Europeans who remember history understand better than most that there is no security, no safety in the appeasement of evil," Reagan said. Shultz repeated this point, and also said he discerned a shift among European governments toward opposing Qaddafi.