Libyan leader Muammar Qaddafi warned at a rally in front of his fortress home today that military bases in Italy and Spain or any other country aiding the U.S. 6th Fleet in the Mediterranean would be targets for retaliation if his confrontation with the United States continues.

Turning what much of the world has seen as his defeat into a celebration of victory, Qaddafi declared that one of the high-tech U.S. missiles fired at his SA5 missile installation had failed to explode and would be turned over to the Soviet Union so its operational secrets could be probed.

In Washington, Pentagon officials said they were aware of the report of the recovered missile but would not comment further.

Speaking for more than an hour at a rally that culminated with the slaughtering of a cow labeled "Reakan," the Libyan leader renewed his calls for Arab unity. In a move sure to complicate North Africa's politics, Qaddafi also proposed an immediate union between Libya and Algeria as well as Syria. Since August 1984, Libya has had such an agreement with Morocco, Algeria's most committed adversary in the region. Qaddafi made no mention of Morocco tonight.

In a warning to Italy, Spain and other countries with U.S. bases, he said, "If this confrontation continues, Libya will attack the U.S. forces stationed in those foreign countries. We will hit anywhere there is an American base."

Addressing a crowd of thousands, mostly uniformed soldiers, sailors and revolutionary guards, Qaddafi for the first time acknowledged that Libya had suffered casualties in its engagement with the 6th Fleet earlier this week.

But he did not give any numbers and he placed the losses in the context of insistent repetition that his batteries of Soviet-made SA5 antiaircraft missiles had succeeded in downing three American fighter planes, despite the Pentagon's flat denial of any losses.

According to Qaddafi's account, the U.S. jets were shot down and Libya allowed U.S. helicopters to retrieve the pilots, one of whom Libya said was killed and another seriously wounded.

Qaddafi said that when he sent a ship out to rescue sailors on a Libyan patrol boat hit by American fire, however, the rescue ship was attacked. Qaddafi said that survivors from the patrol boat who were picked up by a Spanish merchant ship on Monday would be shown to the public on Libyan television soon.

While Qaddafi has presented no proof that American planes were downed and most analysts found the claim implausible when it was first made this week in official Libyan media, the claim to have recovered a dud American missile is somewhat different.

The Pentagon has said that sophisticated HARM (High Speed Antiradiation) missiles were fired at the controlling radar installation of the SA5s near the Libyan town of Surt on Monday and again Tuesday.

The American missiles are designed to home in on the radar signals at the SAM site and destroy its transmitter. According to reports from the Pentagon, after the first attack the radar signal went dead, but it began again a few hours later, prompting the second attack.

Because the HARMs are fired from a distance of several miles by jet fighters, there was apparently no visual sighting of their impact by the pilots who released them.

Several foreign residents of Surt whose homes are near the SAM installations have told diplomats here and a few reporters who went there yesterday that they heard no blasts on Monday or Tuesday.

The Libyan leader did acknowledge that one U.S. missile exploded on Libyan territory without making clear whether it came near the targeted radar unit. But he called any claim that his own missiles had been hit or destroyed "a gross lie."

Qaddafi at times appeared exultant as he spoke to the crowd from the balcony of the main guardhouse at the entrance to the Aziziya barracks, where he lives surrounded by elite troops and modern Soviet tanks, their guns pointed outward toward the gate.

Qaddafi proclaimed that "the line of death" he had drawn at Parallel 32:30 north at the entrance to the Gulf of Sidra had proved to be just that for the United States.

The gulf, which the United States and most other countries refuse to recognize as Libyan waters beyond the 12-mile limit, is "in the heart of Libya," Qaddafi said.

If the American ships and airplanes return to the Gulf of Sidra, he vowed, they would be attacked again.

The crowd shouted anti-American slogans.

But Qaddafi added that any Americans living here -- the total is estimated to be several hundred, most working in the oil business -- were Libya's friends and would never be hurt.

Just when Qaddafi left the balcony to return inside the barracks, a spotlight shone on a cow led into the crowd, its side painted in Arabic and misspelled Roman letters with the name "Reakan."

Soldiers and other youths in the crowd began to beat it and chant, then slit its throat, dancing in the blood that spilled across the asphalt.

"Reagan is a dog man," one soldier in a red beret said in broken English, grinning. "We will kill him."

Such symbolism, rhetoric and attention to the media are characteristic of Qaddafi, and much of what he said tonight may have been meant to shore up domestic opinion.

But his threats against the West and his ambitions for Arab unity, while often overstated and unrealistic, have been carried out frequently enough to give pause to many of his listeners abroad.

The Soviet Union and Libya have dropped plans to sign a friendship treaty, but a Soviet spokesman said relations with Qaddafi were friendly, Reuter reported from Moscow.

Qaddafi said he had sent a telegram to Nicaraguan President Daniel Ortega offering to help Nicaragua in its fight against the United States.

Qaddafi asked voters in Sudan's upcoming election to cast their ballots for the party that advocates a union of the Arab world.

Diplomats report that Libya has offered private assurances that it will not strike at targets in Italy in retaliation for the actions of the 6th Fleet, which often uses naval bases on Italian territory. He had warned before that if the Americans attacked Libya, he would turn the Mediterranean into a "lake of blood" and strike at NATO bases in Europe.