CAIRO, JULY 11 -- The Egyptian Air Force in February 1983 was forced by news leaks in the United States to abort an attack on the Libyan Air Force after months of planning with Sudanese and U.S. intelligence services to lay a sophisticated trap for Libyan leader Moammar Gadhafi, according to sources here and in Washington.

The joint operation, conceived and developed by former Sudanese president Jaafar Nimeri and his security forces, was designed to lure Libya into invading Sudanese airspace so that a quick and hopefully devastating counterattack could then be unleashed by Egypt, Sudan's northern neighbor.

Sources familiar with the operation said senior officials in Washington, Cairo and Khartoum agreed to run the entrapment scheme in order to wipe out as much as one-third of Gadhafi's Air Force and deter him from destabilizing his weaker neighbors.

The plan called for Sudanese undercover agents, who had been acting for some time as a pro-Libyan revolutionary movement in Khartoum, to seek Libyan military intervention to topple the prowestern Nimeri regime in Sudan.

As soon as Gadhafi took the bait and sent waves of his bombers into Sudanese airspace, Egypt's large Air Force -- guided by U.S. AWACS surveillance planes and refueled, if necessary, by airborne U.S. tankers -- was to launch a counterstrike against the Libyan force.

Although the operation was aborted when news leaked about the movement to the Middle East of the AWACS aircraft and the possible redeployment of an aircraft carrier task force, the covert deception and entrapment objectives of the 1983 episode have never been revealed.

A White House spokesman, asked about the U.S. role in the operation, declined to comment. In Cairo, a spokesman for the Egyptian military command also would not comment. A spokesman for Nimeri, who was deposed in 1985 and lives in Cairo, likewise refused to discuss the operation.

The incident represents the earliest known commitment by the Reagan administration to support Egypt secretly in a military confrontation with Libya.

Later, in 1985 and 1986, the United States sent envoys on secret missions to Cairo to discuss whether Egypt might be willing to mount a military attack on Libya, but sources here and in Washington said the Egyptian leadership, especially President Hosni Mubarak, had cooled to the idea.

Today, secret military cooperation between the United States and Egypt remains one of the most sensitive aspects of relations between the two countries, as Egypt seeks to maintain a nonaligned profile in the Third World and Washington tries to broaden its capability to respond militarily in the volatile Middle East.

Earlier this year, for instance, the United States and Egypt quietly began cooperating to supply increased military aid and airlift capability to Chad, whose under-equipped armed forces, assisted by France, eventually routed a much larger Libyan occupation force in northern Chad.

The greatest advocate of secret military cooperation in the Egyptian leadership has been the defense minister, Field Marshal Abdul-Halim Abu Ghazala, a westernized officer who served as Egypt's military attache in Washington for a number of years and who wants to rebuild Egypt's armed forces with American military aid and technical know-how.

But Mubarak, a cautious leader on the threshold of his second term since the assassination of Anwar Sadat in 1981, pursues a political vision of a nonaligned Egypt, friendly to its western creditors and arms suppliers, especially the United States, yet independent enough to reclaim the Arab leadership role that Egypt exercised during the rule of the charismatic Gamal Abdel Nasser in the 1950s and 1960s.

Sources said the 1983 entrapment plan against Gadhafi was one example of a joint U.S.-Egyptian military action Mubarak was willing to undertake, but only on condition that the U.S. role remain secret. Loath to be seen attacking another Arab state, Mubarak could justify an Egyptian counterstrike by waiting for Gadhafi to violate Sudan's airspace and then invoking a mutual defense pact Egypt had signed with Sudan in 1976.

The U.S. policy objective in supporting the planned 1983 strike, according to these sources, was to demonstrate to the Libyan leader that his attempts to subvert and intimidate his weaker neighbors in Africa would be met by force.

Prior to the 1983 episode, the sources said, Sudanese security forces had detected or thwarted a total of 55 hostile acts or subversive operations against Sudan's prowestern government. These included fomenting trouble in southern Sudan, where a largely non-Arab, non-Moslem population long has been estranged from the Moslem majority in the north.

Sudan had retaliated by lending support to dissident Libyan groups and allowing the Egyptian military to train anti-Gadhafi rebels at secret bases outside Khartoum. Nimeri also allowed anti-Gadhafi radio broadcasts to be beamed into Libya from a radio transmitter on the outskirts of the Sudanese capital.

The sources pointed out that from the outset of the Reagan administration, U.S. officials were concerned about the vulnerability of Sudan. Then-secretary of state Alexander M. Haig Jr. moved early to increase military aid to Khartoum to bolster the country's defenses, they noted.

At the time, U.S. and Egyptian officials were worried that Libya, working independently or in concert with the Marxist regime in Ethiopia, might topple Nimeri, threatening Egypt's southern flank and destabilizing all of Central Africa.

The stability of Sudan, through which flow the strategic waters of the Nile, has always been a critical item on Egypt's foreign policy agenda.

As it is, Gadhafi has outlasted his longtime foe. Nimeri was ousted in a bloodless coup in April 1985 and lives in exile in a Cairo villa, two blocks away from Mubarak's palace. A military transitional military government administered Sudan for a year until elections were held. The new government in Khartoum, formed by Sadiq Mhadi in the spring of 1986, has cooled relations with Cairo and downgraded the mutual defense pact with Egypt while improving its ties to Gadhafi.

The 1983 attack was aborted when word leaked in Washington that the United States had sent AWACS planes to Egypt, and after ABC News reported U.S. military movements made in response to reported fears that Libya was about to launch an attack to "overthrow the shaky, pro-American government of Sudan, headed by President Jaafar Nimeri."

During a nationally televised news conference that same evening, President Reagan was asked whether Sudan was threatened and whether he would introduce forces to stop Gadhafi from toppling the government in Khartoum.

"I don't think there's any occasion for that; it's never been contemplated," Reagan said. "But we've known that the Sudan is one of the neighboring states that he has threatened with destabilizing and so forth, just as he has with Chad. And that's all I can say about that. But, no, we don't have any forces in that area that would be involved."

But according to sources familiar with the operation, the planned attack on Libyan forces followed a "very sophisticated" deception operation initiated by the Sudanese intelligence service some months earlier.

As the operation developed, it was closely monitored and eventually joined and supported by the CIA and Egyptian military intelligence, the sources said.

By the time it matured in early 1983, it was being directed by Egypt's defense minister, Abu Ghazala, and had the approval of Mubarak.

In Washington, the entrapment of Libya's leader and the attack on his forces if they moved against Sudan were approved by President Reagan on the weekend of Feb. 12-13 and were being directed from the White House by then national security adviser William P. Clark and his deputy, Robert C. McFarlane.

The deception, according to sources, began sometime in late 1982 when Sudan's intelligence service set up its own pro-Libyan revolutionary "cell" in Khartoum. This cell, all of whose members were agents of Sudan's secret service, contacted antigovernment dissidents and gradually opened a channel of communication to Tripoli, sources said.

In the course of making contact with Libya's political and military leaders, the cell of double agents convinced the Libyans that Sudan's Nimeri could be ousted in a lightning coup, but only if Libya provided air support.

As the discussions between the Sudanese agents and Libya progressed, Sudanese intelligence officials shared details of the entrapment scheme with Egyptian military intelligence officials and with CIA officers in Khartoum.

According to the sources, the Egyptians and the U.S. intelligence officials did not at first show interest in the Sudanese operation, believing that the Sudanese double agents could not sufficiently establish their credentials with Gadhafi to entice him to take a substantial military risk.

But over the weeks and months of the operation, sources said, it was clear that the Libyans were hooked and that Gadhafi had given his approval for Libyan intelligence to work with the Sudanese dissident "cell" to plan the overthrow of Nimeri.

The Sudanese agents requested and received Tripoli's commitment to send its Air Force against the Khartoum government to force a quick capitulation by Nimeri, thus allowing the "cell" of pro-Libyan dissidents to seize power quickly on the ground.

In the countdown to the operation, U.S. reconnaissance satellites and aircraft observed Gadhafi moving major elements of the Libyan Air Force to a large air base at the Kufra oasis in southeastern Libya, the sources said. Aside from the would-be attack on the invading aircraft, the base at Kufra was also a possible target.

In the last stages of the planning, Abu Ghazala informed U.S. officials that Egypt could not carry out the attack on Libya's large and powerful Air Force without "eyes" in the sky, as one source put it, as well as aerial refueling capabilities for its American-built interceptors.

U.S. officials quickly offered to provide AWACS planes and as many KC10 and KC135 tanker aircraft as might be needed to refuel Egypt's airborne assault force, thus giving Egypt a critical command and control advantage.

Mubarak, according to sources, laid down an absolute condition that America's support role in the operation would have to be provided secretly. U.S. officials accepted this condition, sources said, recognizing Mubarak's sensitivity to any suggestion that Egypt's armed forces operate as an extension of U.S. military power in the region.

Details of the American contingency planning could not be learned, but the sources said that the American role was to back up Egypt's strike even if the situation on the ground escalated to a major confrontation between Egyptian and Libyan military forces.

The operation was in its final countdown during the week of Feb. 14 when ABC News Pentagon correspondent John McWethy prepared a report saying that the United States had moved the aircraft carrier USS Nimitz and three of its escorts from the coast of Lebanon to waters nearer Libya to discourage Gadhafi from "starting a war," the network said.

McWethy's report was scheduled to air Wednesday, Feb. 16, when Clark telephoned ABC executives and asked them to delay it, citing what White House officials later said were "intelligence reasons, involving sources and methods."

But ABC went ahead, quickly followed by others, with an account of the Libyan threat to Sudan and U.S. and Egyptian planning to thwart it. None of the broadcasts dealt with the deception operation.

Sources said the broadcasts not only telegraphed U.S. and Egyptian intentions to Gadhafi, but violated Mubarak's absolute condition that U.S. military support remain secret.

"The whole operation just kind of fell apart," explained one source. Gadhafi did not launch his aircraft and the Egyptian strike force lost the element of surprise and the support of political leaders in Cairo.

At the time, sources added, there was coolness toward the operation in some quarters, including the Pentagon, and speculation that the news had been leaked to thwart it. Others speculated that movement of the AWACS is hard to keep secret.

A year after the aborted operation, in March 1984, Gadhafi sent a lone bomber into Sudan to bomb the radio station at Omdurman. Once again, Egypt and the United States responded by sending AWACS planes, as well as a large airlift of Egyptian forces to Sudan. But by the time the forces were ready to respond, Gadhafi's Air Force had withdrawn, leaving no targets within striking distance.

In April 1986, the United States staged a surprise night bombing attack on Libya in retaliation for Libya's alleged involvement in the terrorist bombing of a West Berlin nightclub. U.S. evidence of Libya's involvement included communications intercepts between Tripoli and the Libyan People's Bureau in East Berlin immediately before and after the nightclub explosion.