The chief military aide to King Juan Carlos was severely injured here today and three aides with him were killed when terrorists on a motorcycle placed a bomb on top of the Army staff limousine taking the general to his office at the royal place.

The Basque separatist organization ETA, in telephone calls, claimed responsibility for the attack, which injured 12 other persons. Despite a vast manhunt, police had made no arrests by late tonight.

The attack, the third against security officials in a week, posed a new threat to Spain's fragile democracy, with Spaniards on one side demanding a military takeover to crush the mounting terrorism while others charged that the attacks were provocations designed to bring about a military coup.

A crowd of several hundred people gathered around the general's shattered car and marched a mile to the general staff headquarters, calling for the Army to take power and for the freeing of Civil Guard Col. Antonio Tejero, who was imprisoned after leading an unsuccessful coup attempt in February.

Today's attack took place in the capital's fashionable Salamanca district just two blocks from where leftists shot dead a general Monday. The same day terrorists killed two Civil Guards in Barcelona.

The military command in the Madrid area canceled all leave for officers following the attack and ordered all troops to remain in their barracks -- steps it did not take after Monday's attacks. Authorities said today's order was intended to protect the military from further attacks.

The target of today's bombing, Gen. Joaquin Valenzuela, 69, underwent a six-hour operation on stomach wounds but was expected to recover, although his condition was listed as serious. The general, who belongs to an aristocratic family, is a close associate of the king and handles all official liaison between Juan Carlos and the armed forces.

Further rightist demonstrations are expected at the funerals tomorrow for those killed in today's blast -- Lt. Col. Guillermo Tevar Saco, the general's aide; a military police bodyguard and the car's Army driver.

Angry demonstrations took place at the funeral in Madrid of Gen. Andres Gonzalez de Suso, a former top aide at the Defense Ministry, who was killed Monday.

Politicians from all parliamentary parties, ranging from Communists to conservatives, called on all Spaniards to stage a two-minute silent protest tomorrow noon to demonstrate a civic response to the increasing political violence.

The call underlined the nervousness among the nation's leaders over the terrorist threat and the possible military reaction. Political violence was a main motive behind the February coup attempt and terrorism has increased since then.

Today's attack brought the number of dead in political violence in Spain this year to 28. Five died before the coup and the rest since, with seven deaths so far this week. Most of the killings have been claimed by ETA but Monday's were claimed by a shadowy, pruportedly leftist organization called the First of October Resistance Group, known by its Spanish acronym of GRAPO.

The government maintained a low-key response today. Prime Minister Leopoldo Calvo-Sotelo met with senior advisers and it was announced that the Cabinet would meet as scheduled Friday. The joint chiefs of staff held a meeting this afternoon that had been scheduled after the shooting of the general Monday.

Speculation heightened, nonetheless, over the motivations behind the violence at this tense post-coup period of Spain's transition from the dictatorship of the late Francisco Franco to the present constitutional monarchy of Juan Carlos. A military takeover and a return to the repressive past has long been a short-term aim of the Basque extremists, whose theoreticians see it as a springboard for a Basque popular revolt.

The GRAPO organization has no ethnic roots nor has it put across a clear political program. It has often been penetrated by police, who have repeatedly claimed that the group had been smashed only to have GRAPO gunmen resurface with renewed terrorist acts. This has led liberal Spanish commentators to hint that GRAPO is a tool of the extreme right, as its destabilizing violence appears timed to coincide with crucial moments in the political transition.

Sources close to the prime minister's office suggest that elements in both the Basque ETA and among GRAPO could be controlled by the Soviet Bloc and that the violence was aimed at keeping Spain in political ferment to prevent the consolidation of democracy and to thwart plans by the government that include membership in NATO and the European Common Market. There has been no evidence to substantiate such charges.